c# - 如果在 Web 应用程序中创建,我们可以在不同的端口上托管 WCF 服务吗?
问题描述
我在 Web 应用程序中有 WCF 服务。服务和应用程序运行良好。Web 应用程序地址为 localhost:53536,服务地址为 localhost:53536/Mobile/MobileService.svc。这些是双工服务,我在不同的应用程序上使用这些服务。这是我的配置
<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="Asm.As.PerformanceMonitor.Web.Mobile.MobileService" >
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="MobileServiceBinding" contract="Asm.As.PerformanceMonitor.Web.Mobile.IMobileService" />
</service>
</services>
如您所见,地址为空。当我添加像http://localhost:1212 这样的地址时,它不起作用。一个错误来拒绝连接。有没有办法在不同的端口上托管服务或服务与应用程序有不同的地址?请注意,该服务将由 Web 应用程序托管。