我有一个 Windows 服务,它在里面托管 WCF 服务。以下是端点如何初始化的定义:
WebHttpBinding binding = new WebHttpBinding(WebHttpSecurityMode.TransportCredentialOnly);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
string url = ConfigurationManager.AppSettings["serviceUrl"];
Uri baseAddress = new Uri(url);
Uri metadataAddress = new Uri(url + "Description");
CallService service = new CallService(controller);
ServiceHost host = new WebServiceHost(service);
host.AddServiceEndpoint(typeof (ICallService), binding, baseAddress);
host.Authorization.PrincipalPermissionMode = PrincipalPermissionMode.UseWindowsGroups;
ServiceDebugBehavior stp = host.Description.Behaviors.Find<ServiceDebugBehavior>();
stp.HttpHelpPageEnabled = true;
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
smb.HttpGetUrl = metadataAddress;
host.Description.Behaviors.Add(smb);
host.Open();
问题是,当使用计算机名称(例如http://mycomputer.mydomain.int:4544/Somthing )访问此 WCF 服务时,我首先收到一个身份验证窗口,然后是 HTTP:400。
如果使用http://localhost:4544/Something,
或关闭 Windows 身份验证访问服务,一切正常。
它有什么问题?