消费WCF服务

4

当我使用实时WCF服务时,出现错误。

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

1个回答

5

将终端点配置放在项目根目录下的 Web.config 文件中。

这是一个带有终端点的 web.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>

上面的示例代码将解决您的问题,但请在您的解决方案中详细描述更多关于您的项目,并在此处放置您的代码。您是在类库中使用web-service并将其引用到您的 Web 应用程序项目中吗?

感谢您的友好回复。 - Aman Soni

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接