36 lines
945 B
C#
36 lines
945 B
C#
|
|
using SoapCore;
|
|||
|
|
|
|||
|
|
namespace MySOAP
|
|||
|
|
{
|
|||
|
|
public class Program
|
|||
|
|
{
|
|||
|
|
public static void Main(string[] args)
|
|||
|
|
{
|
|||
|
|
var builder = WebApplication.CreateBuilder(args);
|
|||
|
|
|
|||
|
|
// Add services to the container.
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
builder.Services.AddSoapCore();
|
|||
|
|
builder.Services.AddSingleton<ICalculatorService, CalculatorService>();
|
|||
|
|
builder.Services.AddControllers();
|
|||
|
|
|
|||
|
|
builder.Services.AddMvc();
|
|||
|
|
var app = builder.Build();
|
|||
|
|
|
|||
|
|
// Configure the HTTP request pipeline.
|
|||
|
|
app.UseRouting();
|
|||
|
|
app.UseAuthorization();
|
|||
|
|
_ = app.UseEndpoints(endpoints =>
|
|||
|
|
{
|
|||
|
|
endpoints.UseSoapEndpoint<ICalculatorService>("/Service.asmx", new SoapEncoderOptions(), SoapSerializer.XmlSerializer);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
app.MapControllers();
|
|||
|
|
|
|||
|
|
app.Run();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|