我一直在做它在VS 2008开发并在Windows Server 2008中托管的WCF服务,IIS 7.0,当我在我的本地环境下运行该服务,其工作正常,但是当我是主持人在生产现场这种服务它不工作。在这种服务,我使用wsHttpBinding绑定,和我使用的安全模式是消息和clientcredential类型是“用户名”
<security mode= "Message">
<message clientCredentialType="UserName" />
</security>
在行为的配置我使用
<behavior name="name">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" httpsGetUrl="https://serviceurl/basic"/>
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<serviceCertificate findValue="CN=WMSvc-AMAZONA-PJ1K606" />
<userNameAuthentication userNamePasswordValidationMode="MembershipProvider" embershipProviderName="WCFSqlProvider" />
</serviceCredentials>
</behavior>
但是当我从我的客户端应用程序使用该服务它给我的错误
有没有渠道积极听取以“//名称,其中服务托管/服务名称/ $元的机器”这通常是由不正确的地址URI造成的。确保向其发送邮件的地址在其上的服务侦听的地址相匹配。
看起来像你的问题是与元数据,根据错误消息。
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" httpsGetUrl="//https://serviceurl/basic"/>
请尝试卸下//
属性的开始httpsGetUrl
,他们可能给你造成麻烦。
下面是配置的几个例子:http://msdn.microsoft.com/en-us/library/ms731317(v=vs.110).aspx
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="Service" behaviorConfiguration="ServiceBehaviour">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="webMyAcc" bindingConfiguration="TransportSecurity" contract="IService"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webMyAcc">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<client />
</system.serviceModel>