没有端点侦听URI可以接受 信息。这通常是由错误的地址或SOAP操作引起的。 有关更多详细信息,请参阅InnerException(如果存在)。
这是我的代码
var client = new DSServiceClient();
client.Methode();
web.config的服务模型部分
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IDSService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="localhost:1695/Service1.svc"; binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDSService" contract="ServiceReference1.IDSService" name="BasicHttpBinding_IDSService" />
</client>
</system.serviceModel>
答案 0 :(得分:0)
检查您使用的URL是否可从asp.net mvc站点访问。如果您使用的是http绑定,则可以将URL复制并粘贴到部署站点的服务器上的浏览器中。该URL应位于您站点的根文件夹中的web.config文件中。
答案 1 :(得分:0)
您使用IIS 7进行托管吗?如果您可以访问您的站点,启用目录浏览(暂时),单击IIS管理器右侧的浏览链接,选择服务类(“something.svc”),它应该在浏览器中弹出。此时,您可以从浏览器复制URL并将localhost替换为服务器名称。您甚至可以继续单击该页面上的顶部链接以访问WSDL。如果出现问题,您可能会收到更有帮助的错误消息。
答案 2 :(得分:0)
这是我的服务的web.config
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="DSWebService.Service1Behavior"
name="DSWebService.Service1">
<endpoint address="" binding="wsHttpBinding"
contract="DSWebService.IDSService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:1695/DSWebService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DSWebService.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false 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>
这是我的客户端web.config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IDSService" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1695/Service1.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IDSService" contract="IDSService"
name="WSHttpBinding_IDSService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
和2项目应该在同一个解决方案上,之后我们添加引用:
DSServiceClient client = new DSServiceClient();
client.Methode();