我有WCF的基本配置问题。我正在开发MobilePhone应用程序。首先,我创建了使用basicHttpBinding的测试桌面应用程序,并且一切都很好。 接下来我使用了相同的代码(唯一区别在于ServerReference - 在手机中,我使用了使用NetCFSvcUtil生成的两个服务器文件)。在电话应用程序中,我得到的端点没有发现异常。 下面我将我的配置。我会很感激的帮助或建议。WCF配置 - basicHttpbinding
问候。
异常在电话那边:
有没有终点在 http://localhost:4444/Service/PhoneService 是可以接受的消息听。这通常是由不正确的地址 或SOAP操作导致的 。有关更多详细信息,请参见InnerException,如果存在 。
电话配置:在浏览器
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding" 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="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:4444/Service/PhoneService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding"
contract="IPhoneService" name="BasicHttpBinding" />
</client>
</system.serviceModel>
**服务器配置的revelant片段**
<service name="Server.PhoneService" behaviorConfiguration="Server.PhoneServiceBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="" contract="Server.IPhoneService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:4444/Service/PhoneService" />
</baseAddresses>
</host>
</service>
//______________________________//
<behavior name="Server.PhoneServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
* 配置*
电话服务服务
您已创建服务。
要测试此服务,您需要 创建一个客户端并使用它来调用 服务。
svcutil.exe的 http://localhost:4444/Service/PhoneService?wsdl
这将生成一个配置文件 和包含 客户端代码文件:您可以使用命令行 以下语法的 svcutil.exe的工具做到这一点类。将这两个文件添加到您的客户端应用程序的 ,并使用生成的客户端类别 调用 服务。例如:
C#
class Test
{
static void Main()
{
PhoneServiceClient client = new PhoneServiceClient();
// Use the 'client' variable to call operations on the service.
// Always close the client.
client.Close();
}
}
您是否从另一台设备(例如另一台开发计算机)测试了客户端配置? – 2011-03-20 23:40:43
嗨,我已经测试了我的笔记本电脑上的所有东西 - 没有防火墙。 – user648518 2011-03-21 02:13:24