对于OWIN/KATANA,内存托管解决方案是可用的: Microsoft.AspNet.WebApi.OwinSelfHost。我想为WCF服务找到类似的方法--可以在内存中运行的集成测试。
发布于 2018-09-27 10:25:09
这只是自我托管服务吗?
// Create the ServiceHost.
using (ServiceHost host = new ServiceHost(typeof(HelloWorldService), baseAddress))
{
// Enable metadata publishing.
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
host.Description.Behaviors.Add(smb);
// Open the ServiceHost to start listening for messages. Since
// no endpoints are explicitly configured, the runtime will create
// one endpoint per base address for each service contract implemented
// by the service.
host.Open();
Console.WriteLine("The service is ready at {0}", baseAddress);
Console.WriteLine("Press <Enter> to stop the service.");
Console.ReadLine();
// Close the ServiceHost.
host.Close();
}https://stackoverflow.com/questions/52534492
复制相似问题