我想從我的WCF服務中使用ASMX Web服務。這是我做了什麼,我得到以下錯誤。 「 」在「http:// ...」沒有端點監聽可以接受該消息,這通常是由不正確的地址或SOAP操作引起的。幫幫我吧。我哪裏做錯了嗎?我缺少什麼?從WCF消費ASMX WebService
我創建了一個WCF服務庫,並添加到ASMX Web服務的引用與提供給我的WSDL文件的幫助。
namespace WCFClueClient
{
public class Service1 : IService1
{
public string GetData(string value)
{
ClueClientServiceReference.InteractiveOrderHandlerClient client = new WCFClueClient.ClueClientServiceReference.InteractiveOrderHandlerClient();
string response = client.handleInteractiveOrder(value);
return string.Format("You entered: {0}", response);
}
}
我有一個控制檯應用程序,它涉及到我的WCF服務
namespace CLUE
{
class Program
{
static void Main(string[] args)
{
CLUETestServiceReference.Service1Client client = new CLUE.CLUETestServiceReference.Service1Client();
string response = client.GetData("JOHN DOE");
}
}
}
我app.config文件
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="InteractiveOrderHandlerBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://alalppnc079.choicepoint.net:8280/CPRules-rfCommunicationEJB/InteractiveOrderHandlerURI"
binding="basicHttpBinding" bindingConfiguration="InteractiveOrderHandlerBinding"
contract="ClueClientServiceReference.InteractiveOrderHandler"
name="InteractiveOrderHandlerPort" />
<endpoint address="http://localhost:8731/Design_Time_Addresses/WCFClueClient/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
contract="WCFCLUETEstServiceReference.IService1" name="WSHttpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
<services>
<service name="WCFClueClient.Service1" behaviorConfiguration="WCFClueClient.Service1Behavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFClueClient/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="wsHttpBinding" contract="WCFClueClient.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WCFClueClient.Service1Behavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
是否將引用添加爲WebService?或作爲大會? – pjnovas 2010-10-28 17:55:49
我將該參考添加爲Webservice。 – BumbleBee 2010-10-28 18:05:24