C# Visual Studio主机上配置的身份验证方案(';匿名';)
我面临着错误 在主机(“匿名”)上配置的身份验证方案不可用 允许在绑定“WebHttpBinding”(“Basic”)上配置的 在VS中运行服务时出现问题C# Visual Studio主机上配置的身份验证方案(';匿名';),c#,wcf,C#,Wcf,我面临着错误 在主机(“匿名”)上配置的身份验证方案不可用 允许在绑定“WebHttpBinding”(“Basic”)上配置的 在VS中运行服务时出现问题 <?xml version="1.0"?> <configuration> <appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> </appSettin
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6" />
<httpRuntime targetFramework="4.6"/>
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" />
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceX_Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="ServiceX.CustomUserNamePasswordValidator, ServiceX"/>
</serviceCredentials>
<!--<serviceAuthenticationManager authenticationSchemes="Basic"/>-->
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttpBinding_Behavior">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
</behaviors>
<!--<protocolMapping>
<add binding="basicHttpBinding" scheme="http" />
</protocolMapping>-->
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="ServiceX.ServiceX" behaviorConfiguration="ServiceX_Behavior">
<endpoint address="" binding="webHttpBinding" contract="ServiceX.IServiceX" behaviorConfiguration="webHttpBinding_Behavior" />
<endpoint address="soap" binding="basicHttpBinding" contract="ServiceX.IServiceX" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
ISS中允许基本身份验证和匿名身份验证在VS中启用匿名身份验证 为什么在visualstudio中wcfweb项目不工作,控制台项目和部署在iisweb应用中的工作正常。有什么区别
我想在WCF中实现基本身份验证,根本原因是IIS Express在默认情况下没有启用基本身份验证。如您所知,我们需要启用
BasicAuthentication
以支持WCFBasicAuthentication
。IIS Express是用ApplicationHost.config
文件配置的。我们应该更新ApplicationHost.config
中的以下值,以启用BasicAuthentication
<security>
<access sslFlags="None" />
<applicationDependencies>
<application name="Active Server Pages" groupId="ASP" />
</applicationDependencies>
<authentication>
<anonymousAuthentication enabled="true" userName="" />
<!-- set to true –->
<basicAuthentication enabled="true" />
<security>
<access sslFlags="None" />
<applicationDependencies>
<application name="Active Server Pages" groupId="ASP" />
</applicationDependencies>
<authentication>
<anonymousAuthentication enabled="true" userName="" />
<!-- set to true –->
<basicAuthentication enabled="true" />