我在ASP.net中创建了一个WCF服务。我想在前进之前检查服务是否正常工作。 因此,sombody可以建议输入的确切URL是什么,并查看输出。 找到我的web.config文件。
<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>
答案 0 :(得分:0)
您可以使用wcftestclient来测试服务
您可以将wcf项目设置为启动项目并调试解决方案,它将在wcftestclient中启动并自动添加您的服务。
或直接从“C:\ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ WcfTestClient.exe”打开 - VS2010
从这里你可以通过传递参数(如果有的话)和test来调用service。
答案 1 :(得分:0)
如果您的意思是在客户端进行检查,那么您可以像下面一样捕获异常并执行您想要做的事情