【问题标题】:Consuming WCF service使用 WCF 服务
【发布时间】:2019-03-25 15:00:12
【问题描述】:

当我使用 Live WCF 服务时,它显示错误

没有可以接受消息的端点监听。这通常是由不正确的地址或 SOAP 操作引起的

【问题讨论】:

    标签: c# asp.net wcf soap wcf-endpoint


    【解决方案1】:

    将您的端点配置放在项目根目录的Web.config 上。

    这是web.configend-point 的示例。

    <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="TransportSecurity">
              <security mode="Transport">
                <transport clientCredentialType="None"/>
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>
        <services>
          <service  behaviorConfiguration="TestWcfHttps1.Service1" name="TestWcfHttps1.Service1">
            <endpoint address="https://MYSERVER/GpTest/Service1.svc" 
    
                      binding="basicHttpBinding" 
    
                      bindingConfiguration="TransportSecurity"
    
                      contract="TestWcfHttps1.IService1">
              <identity>
                <dns value="" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="TestWcfHttps1.Service1">
              <serviceMetadata httpsGetEnabled="true" externalMetadataLocation="https://MYSERVER//GpTest/Service1.wsdl" />
              <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
    </configuration>
    

    上面的示例代码将解决您的问题,但请在您的解决方案中描述更多关于您的项目并将您的代码放在这里。您是否在类库中使用了web-service 并在您的网络应用项目中引用它?

    【讨论】:

    • 感谢您的友好回复。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-11
    • 2011-08-10
    • 2014-07-13
    相关资源
    最近更新 更多