简体   繁体   English

使用WCF服务

[英]Consuming WCF service

When I use Live WCF service it shows error 当我使用Live WCF服务时,它显示错误

There was no endpoint listening at this that could accept the message. 没有端点可以接受该消息。 This is often caused by an incorrect address or SOAP action 这通常是由错误的地址或SOAP操作引起的

Put your end-point configuration on Web.config on root of your project. 将您的端点配置放在项目根目录的Web.config上。

this is sample of a web.config with end-point . 这是带有end-pointweb.config示例。

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

The above sample code will fix your problem, but please describe more about your projects on your solution and put your code here. 上面的示例代码将解决您的问题,但请在解决方案中描述有关您的项目的更多信息并将代码放在此处。 Did you consume the web-service in a class library and reference it on your web-app project ? 您是否在类库中使用web-service并在Web应用程序项目中引用它?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM