我在Angular中有一个Web应用程序,并且我也在此Web应用程序中创建了WCF服务。当我运行Web应用程序时,URL为localhost:53536 /#/ Page。服务地址是localhost:53536 / Service / Service / svc。我托管了Web应用程序,并且Web应用程序和WCF服务都可以正常工作。但是我想在不同的端口或不同的地址上托管Web服务。我怎样才能做到这一点。这是我的web.config
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="" >
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<bindings>
<wsDualHttpBinding>
<binding name="MobileServiceBinding" closeTimeout="00:00:05" openTimeout="00:00:05">
<readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service name="Web.Mobile.MobileService" >
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="MobileServiceBinding" contract="Web.Mobile.IMobileService" />
</service>
</services>
</system.serviceModel>
如何为WCF服务分配其他地址?
答案 0 :(得分:1)
这听起来像是address
配置中的endpoint
为空时项目设置中的自动分配端口。
部署Web服务时只需修改address
即可满足您的需求
<services>
<service name="Web.Mobile.MobileService" >
<endpoint address="http://whatever.you.like:1337" binding="wsDualHttpBinding" bindingConfiguration="MobileServiceBinding" contract="Web.Mobile.IMobileService" />
</service>
</services>
或修改项目配置以在Visual Studio中运行/调试Web服务。