我试图在服务器上发布我的双工 wcf 服务但没有成功,我可以在本地 IIS 上发布它,但是当我将它发布到服务器时,它的地址变为net.tcp://win-rhkt30stjd7/Broadcastor/BroadcasterService.svc
. 正如您所同意的那样,在客户端上创建服务引用时,这样的地址根本没有用。我尝试将其发布为 WCF 应用程序项目和服务库项目,但两者都给出了相同的结果。我的文件中可能缺少某些东西,Web.config
但我不知道它是什么。请帮帮我。下面是我的Web.config
文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="false" />
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<services>
<service name="BroadcastorServiceApp.BroadcastorService">
<endpoint binding="netTcpBinding" contract="BroadcastorServiceApp.IBroadcastorService">
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding>
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>