WCF参考外部Web服务

时间:2016-04-05 12:44:05

标签: c# web-services wcf

我创建了一个WCF,它从ms sql db和外部WCF中提取数据。 当我调试服务它工作正常,但一旦我在现实世界中尝试它,我得到这个错误:

类型&System; Service.ServiceModel.FaultException`1'的未处理异常发生在mscorlib.dll

其他信息:http://10.11.11.22/AIM/AIMIS没有可以接受该消息的端点。这通常是由错误的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)。

一些app.config:

<bindings>
  <basicHttpBinding>
    <binding name="AdapterFacadeBinding" />
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://10.11.11.22/AIM/AIMIS" binding="basicHttpBinding"
    bindingConfiguration="AdapterFacadeBinding" contract="AIMISWS.AdapterFacadePortType"
    name="AdapterFacadePort" />
</client>
<services>
  <service name="EcoGridIBMExport.CustomerService">
    <endpoint address="" binding="basicHttpBinding" contract="EcoGridIBMExport.ICustomerService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8733/Design_Time_Addresses/EcoGridIBMExport/Service1/" />
      </baseAddresses>
    </host>
  </service>
</services>

在我连接的客户端应用上:

static void Main(string[] args)
{
    CustomerServiceClient client = new CustomerServiceClient();  
    Console.WriteLine(client.GetMeter());
    Console.ReadLine();

    client.Close();
}

我做错了什么?

1 个答案:

答案 0 :(得分:0)

Is this what you wont to see:

System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: There was no endpoint listening at http://10.11.11.22/AIM/AIMIS that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. (Fejloplysningerne er lig med En ExceptionDetail, som sandsynligvis er oprettet af IncludeExceptionDetailInFaults=true, med værdien: System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://10.11.11.22/AIM/AIMIS that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ----> System.Net.WebException: Unable to connect to the remote server ----> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.11.11.22:80 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) --- Slut på staksporingen for oplysninger...).