使用WCF服务

Ama*_*oni 4 c# asp.net wcf soap wcf-endpoint

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

没有端点可以接受该消息.这通常是由错误的地址或SOAP操作引起的

Sia*_*ash 5

将终点配置放在Web.config项目的根目录上.

这是一个web.config带的样本end-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>
Run Code Online (Sandbox Code Playgroud)

上面的示例代码将解决您的问题,但请在解决方案中描述有关您的项目的更多信息并将代码放在此处.您是否web-service在类库中使用它并在您的Web应用程序项目中引用它?