我更改了Web.Config,该服务正在使用匿名身份验证。虽然在IIS7.5中启用了Windows身份验证并禁用了匿名身份验证,但它会开始给我以下错误。请帮忙。
主机上配置的身份验证方案 ('IntegratedWindowsAuthentication')不允许配置的那些 绑定'basicHTTP'('匿名')。请确保 SecurityMode设置为Transport或TransportCredentialOnly。 此外,这可以通过更改身份验证来解决 通过IIS管理工具,通过这个应用程序的方案 ServiceHost.Authentication.AuthenticationSchemes属性,在 应用程序配置文件在 element,通过更新绑定上的ClientCredentialType属性, 或者通过调整AuthenticationScheme属性 HttpTransportBindingElement。
Web.config如下:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="JSONBinding"></binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="basicHTTP">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"></transport>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="basicBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="JSON">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="RestWCFService.CalculationService" behaviorConfiguration="basicBehavior">
<endpoint address="" binding="basicHttpBinding" contract="RestWCFService.ICalculatorService" bindingName ="basicHTTP"></endpoint>
<!--
<endpoint behaviorConfiguration="JSON" binding="webHttpBinding" bindingConfiguration="JSONBinding" contract="RestWCFService.ICalculatorService" name="JSONService"></endpoint>
-->
</service>
</services>
<protocolMapping>
<add binding="basicHttpBinding" scheme="http"/>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
提前致谢!!!
答案 0 :(得分:2)
您没有在端点中使用名为basicHTTP
的基本HTTP绑定。将端点中的属性从bindingName="basicHTTP"
更改为bindingConfiguration="basicHTTP"
。
顺便说一下,您必须在IIS中同时启用匿名身份验证和Windows身份验证。