在服务器上测试时的WCF端点异常

时间:2013-05-23 10:06:51

标签: vb.net wcf

我想知道是否有人可以指出我正确的方向,因为拉掉了我留下的小头发; 0(。

我已经选择了某个人的vb.net项目,但在WCF方面经验很少,而且在尝试让它在服务器上运行时遇到问题。

我在IIS上托管本地和服务器上的测试。

如果我在我的机器上本地运行,那么我可以将服务整理好并且一切正常,但是我现在已经在服务器上设置了这个服务的IIS进行测试,并且在查看事件查看器时出现以下错误。

错误:端点异常信息:

Exception type: InvalidOperationException 
Exception message: Service 'InterfaceServiceHost.InterfaceService' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element. 

我已经四处搜索并查看了一些推荐的内容,但似乎无法找到错误。

web.config文件:

<configuration>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="InterfaceServiceHost.Service1Behavior"
        name="InterfaceServiceHost.InterfaceService">
        <endpoint address="" binding="wsHttpBinding" name="wsHttpBinding_InterfaceService"  bindingConfiguration="wsHttpBindingBinding"
      contract="InterfaceServiceHost.IInterfaceService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
<endpoint address="mex" binding="mexHttpBinding" name="mexHttpBinding"
      contract="IMetadataExchange" />
  </service>
</services>
<bindings>
  <wsHttpBinding>
    <binding name="wsHttpBindingBinding" maxBufferPoolSize="5242880" sendTimeout="00:05:00" receiveTimeout="00:05:00" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxBytesPerRead="2147483647" />
      <security mode="None">
        <message clientCredentialType="None" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="InterfaceServiceHost.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="true"/>
  <serviceThrottling maxConcurrentCalls="32" maxConcurrentInstances="256" maxConcurrentSessions="40"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

服务器网络浏览器上显示的信息:

http://localhost/InterfaceServiceHost/interfaceService.svc

您已创建了一项服务。

要测试此服务,您需要创建一个客户端并使用它来调用该服务。您可以使用命令行中的svcutil.exe工具执行此操作,语法如下:

svcutil.exe http://xxxxx.xxx.local/InterfaceServiceHost/InterfaceService.svc?wsdl

Class Test
    Shared Sub Main()
        Dim client As InterfaceServiceClient = New InterfaceServiceClient()
        ' Use the 'client' variable to call operations on the service.
        ' Always close the client.
        client.Close()
    End Sub
End Class

任何帮助都会非常感谢,提前谢谢。

1 个答案:

答案 0 :(得分:0)

你可以尝试为地址提供一些价值吗

<endpoint address="<YOUR SERVICE ADDRESS>" binding="wsHttpBinding" name="wsHttpBinding_InterfaceService"  bindingConfiguration="wsHttpBindingBinding"