我在ASP.net中创建了一个WCF服务。在继续之前,我想检查一下服务是否正常。那么,有人可以建议输入的确切URL是什么并查看输出。找到我的网。配置文件。
<system.serviceModel>
<bindings>
<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>
<binding name="WSHttpBinding_IService11" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
contract="Myservice.IService1" name="WSHttpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService11"
contract="ServiceReference1.IService1" name="WSHttpBinding_IService11">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
您可以使用wcftestclient来测试服务
您可以将WCF项目设置为启动项目并调试解决方案,它将在wcftestclient中启动并自动添加您的服务。
或直接从"C:Program FilesMicrosoft Visual Studio 10.0Common7IDEWcfTestClient.exe" - VS2010
从这里你可以通过传递参数(如果有的话)和测试来调用服务。
这里是另一个链接
如果您的意思是在客户端检查,那么您可以像下面这样捕获异常并执行您想要执行的操作
- CommunicationObjectFaultedException//通信错误
- EndpointNotFoundException//端点未找到或未工作
- FaultException//服务器抛出的FaultException