C# 禁用匿名身份验证导致WCF REST服务出现问题
在主机上配置的身份验证方案 ('IntegratedWindowsAuthentication')不允许在上配置的 绑定“BasicHttpBinding”(“匿名”)。请确保 SecurityMode设置为Transport或TransportCredentialOnly。 此外,这可以通过更改身份验证来解决 通过IIS管理工具,通过 中的ServiceHost.Authentication.AuthenticationSchemes属性 应用程序配置文件位于 元素,通过更新绑定上的ClientCredentialType属性, 或者通过调整 HttpTransportBindingElement 我们在IIS 7.5上托管了一个WCF Rest服务 如果启用了匿名身份验证(在IIS中),我们可以浏览该服务 但如果禁用IIS上的匿名身份验证,则会出现上述错误消息 我们正在使用webHttpBinding和以下定义的绑定C# 禁用匿名身份验证导致WCF REST服务出现问题,c#,rest,wcf,iis-7.5,C#,Rest,Wcf,Iis 7.5,在主机上配置的身份验证方案 ('IntegratedWindowsAuthentication')不允许在上配置的 绑定“BasicHttpBinding”(“匿名”)。请确保 SecurityMode设置为Transport或TransportCredentialOnly。 此外,这可以通过更改身份验证来解决 通过IIS管理工具,通过 中的ServiceHost.Authentication.AuthenticationSchemes属性 应用程序配置文件位于 元素,通过更新绑定上的Clien
<binding name="ExternalServicesRestBinding" closeTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="10:10:00" sendTimeout="10:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
</security>
</binding>
端点行为为
<behavior name="endpointBehaviourForRestService">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<webHttp />
</behavior>
你认为有什么建议或线索可以解决这个问题吗
提前谢谢
Rajkumar.我在申请中也遇到过类似的问题 我对该服务的服务行为配置和名称有异议。我有如下正确答案。这解决了我的问题 示例:
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="service_namespace.service_Class" >
另一点是,在实现REST服务时,我们需要将Factory=“System.ServiceModel.Activation.WebServiceHostFactory”
添加到.svc文件中。(您会收到一个“Endpoint not found”错误,但只要您正确调用该服务,该服务就可以正常工作。如前所述,我使用的是默认的Web.config和.NET 4.6(简化的WCF配置),因此我可能还需要添加端点详细信息才能再次工作)
请查看您的配置设置和svc文件。感谢Jagadeesh的建议。这似乎解决了问题。