【发布时间】:2015-10-21 21:26:26
【问题描述】:
我正在使用 VS2015 并为 Web 服务创建 WPF 客户端应用程序。该服务在我的网络上的专用 Web 服务器上的 IIS 上运行。当我尝试添加服务引用时,我收到一条错误消息,指出它无法识别 uri 前缀。
web服务web.config文件如下:
<system.serviceModel>
<diagnostics wmiProviderEnabled="true">
<messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<bindings>
<netTcpBinding>
<binding name="netTcpBinding-Streamed" transferMode="Streamed" maxReceivedMessageSize="1073741824">
<readerQuotas maxStringContentLength="8192000" />
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceAuthorization principalPermissionMode="UseWindowsGroups" />
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="[Namespace].Services.IIS">
<endpoint address="net.tcp://[server:port]/[website on iis]/Shared/Shared.svc" bindingConfiguration="netTcpBinding-Streamed" binding="netTcpBinding" contract="[Namespace].Services.Interfaces.Shared.IShared" />
<endpoint address="net.tcp://[server:port]/[website on iis]/UITax/Reports.svc" bindingConfiguration="netTcpBinding-Streamed" binding="netTcpBinding" contract="[Namespace].Services.Interfaces.UITax.Reports.IReport" />
<endpoint address="net.tcp://[server:port]/[website on iis]/UITax/Assignments.svc" bindingConfiguration="netTcpBinding-Streamed" binding="netTcpBinding" contract="[Namespace].Services.Interfaces.UITax.Assignments.IAssignments" />
</service>
</services>
<extensions>
<behaviorExtensions>
<add name="errorHandler" type="[Namespace].Services.Framework.WCF.WcfErrorHandlerExtension, [Namespace].Services.WCF.Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
我在“地址”框中输入“net.tcp://[server:port]/[website on iis]/Shared/Shared.svc”,然后单击“开始”并出现错误。
我做错了什么?
VS2015 错误信息:
The URI prefix is not recognized.
Metadata contains a reference that cannot be resolved: 'net.tcp://[server:port]/[website on iis]/shared/shared.svc'.
The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:04:59.9980001'.
An existing connection was forcibly closed by the remote host
If the service is defined in the current solution, try building the solution and adding the service reference again.
【问题讨论】:
-
请在您的帖子中包含错误信息。
-
CodeCaster:关于您的第一个参考链接 - 其他应用程序正在使用 Web 服务,但我无权访问源代码。所以我假设 web.config 文件不是问题。
-
CodeCaster:至于您的第二个参考链接,服务项目不是我的解决方案或项目的一部分。另外设置“httpGetEnabled=true”会破坏所有使用该服务的现有应用程序。