没有频道在wcf上主动收听

时间:2014-02-10 10:18:51

标签: wcf wcf-security wcf-wshttpbinding

我一直致力于在VS 2008中开发并托管在Windows Server 2008,IIS 7.0中的WCF服务, 当我在我的本地环境中托管此服务时,它工作正常,但是当我在生产站点中托管此服务时,它无法正常工作。 在这个服务中我使用的是WShttpbinding绑定,我使用的是安全模式的消息,而clientcredential类型是“Username”

 <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>

但是当我从我的客户端应用程序中使用该服务时,它会给我错误

没有频道主动侦听“//托管服务的机器名称/ servicename / $ metadata”这通常是由错误的地址URI引起的。确保 发送消息的地址与服务正在侦听的地址相匹配。

2 个答案:

答案 0 :(得分:0)

根据错误消息,您的问题似乎与元数据有关。

<serviceMetadata  httpGetEnabled="true" httpsGetEnabled="true" httpsGetUrl="//https://serviceurl/basic"/>         

尝试删除//属性开头的httpsGetUrl,它们可能会给您带来麻烦。

以下是一些配置示例:http://msdn.microsoft.com/en-us/library/ms731317(v=vs.110).aspx

答案 1 :(得分:0)

<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>