我在具有自签名证书的本地计算机上执行了wcf用户名/密码身份验证,一切正常,但是当我将应用程序放在IIS 7.5和Windows Server 2008 R2上时,它给了我错误:
找不到与具有绑定(bind)WSHttpBinding的端点的方案http匹配的基地址。注册的基址方案为[https]。
我的网络服务cfg:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceCredentialsBehavior">
<serviceCredentials>
<serviceCertificate findValue="cn=AmicCert" storeName="Root" storeLocation="LocalMachine" />
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Util.CustomUserNameValidator, Util" />
</serviceCredentials>
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceCredentialsBehavior" name="Service">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="MessageAndUserName" name="SecuredByTransportEndpoint" contract="IService" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="MessageAndUserName">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client />
</system.serviceModel>
<system.web>
<compilation debug="true" />
</system.web>
</configuration>
最佳答案
听起来好像您托管的IIS网站实例仅配置了HTTPS(SSL)。右键单击该网站实例,然后选择“编辑绑定(bind)...”。您是否在其中看到端口80(普通HTTP)?还要检查“SSL设置”功能,以确保“始终需要”选项未打开。