2
我有一个c#REST web服务,它具有用于调试目的的控制台主机。我需要验证模式添加到这个服务,我的控制台主机的代码如下所示:WCF REST服务控制台主机
WebServiceHost host = new WebServiceHost(typeof(WebService,new Uri[] { new(http://localhost:8000/")});
WebHttpBinding binding = new WebHttpBinding();
host.AddServiceEndPoint(typeof(WebService, binding, "");
host.Open();
Console.WriteLine("Testing Webservice through console. Press Enter to quit.");
Console.ReadLine();
host.Close(System.TimeSpan.Zero);
web.config中的身份验证可以通过补充说:
<system.web><authentication mode="Windows"/></system.web>
如何添加认证模式到我的控制台主机?
什么框架版本? .NET 3.5或4.0或不同的? – VoodooChild
这不是一个ASP.NET Web服务(ASMX),它是WCF。 –
你有没有运气? –