我想知道是否有人能指出我正确的方向,因为我拉了我漏掉的那根小头发;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
任何帮助将不胜感激,在此先感谢。