我正在使用
开发WCF服务应用程序我找到了this MSDN article,但这是 HTTPS 的示例。
已经对web.config进行了巨大的挂载尝试,但我无法弄清楚如何配置。
任何帮助将不胜感激:)
由于
答案 0 :(得分:0)
您可以将绑定更改为基本绑定而不是wsBining
<basicHttpBinding>
<binding name="BasicBinding" receiveTimeout="00:01:00"
sendTimeout="00:01:00">
<security mode="None">
<transport clientCredentialType="Basic"/>
<message clientCredentialType="UserName" />
</security>
</binding>
</basicHttpBinding>
另一个选项是,您可以向应用程序添加自定义用户验证方法(Class)并在其中创建身份验证
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<useRequestHeadersForMetadataAddress />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<clientCertificate>
<authentication customCertificateValidatorType="WCFServices.clsCertificateValidator, App_Code/WCFServices" certificateValidationMode="Custom" revocationMode="NoCheck" />
</clientCertificate>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WCFServices.clsUserValidator, App_Code/WCFServices" />
<peer>
<peerAuthentication customCertificateValidatorType="WCFServices.clsCertificateValidator, App_Code/WCFServices" certificateValidationMode="Custom" revocationMode="NoCheck" />
<messageSenderAuthentication customCertificateValidatorType="WCFServices.clsCertificateValidator, App_Code/WCFServices" certificateValidationMode="Custom" revocationMode="NoCheck" />
</peer>
<issuedTokenAuthentication audienceUriMode="Never" customCertificateValidatorType="WCFServices.clsCertificateValidator, App_Code/WCFServices" certificateValidationMode="Custom" revocationMode="NoCheck" allowUntrustedRsaIssuers="true" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
在此课程中,如果您需要停止用户抛出异常。