我正在尝试将以WCF编写的Web服务公开给开放的互联网,但我无法将其配置为从外部网址中使用。
网络服务在https://ourportal.internaldomain.intra:9011/FrontEndWS内部托管,效果很好。我们在https://www.internetdomain.com.mt/FrontEndWS上公开了Web服务,但是当从外部地址访问它时,soap URL仍然引用内部地址。
我们的设置如下。我们不需要在内部公开Web服务,只需在互联网上公开,这样可以简化配置。
<bindings>
<basicHttpBinding>
<binding name="LargeMessagingBinding" maxBufferSize="99999900" maxBufferPoolSize="524288000" maxReceivedMessageSize="99999900">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="99999900" maxBytesPerRead="99999900" maxNameTableCharCount="2147483647" />
<security>
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="6553600" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="false" />
答案 0 :(得分:0)
为了将您的Web服务公开给外部世界,您可以将WCF服务放在IIS中的网站下的虚拟目录中。
现在你的网址&#34; www.internetdomain.com.nt
&#34;将映射到特定的IP地址(可从外部访问),此IP地址是WCF服务所在的服务器的IP地址。
IIS收到有关此IP的任何请求,并确定如何提供请求。
如果上述情况正常,那么您的WCF服务的URL将是:
http://www.internetdomain.com.nt/virtualdirectory/FrontEndWS
https://www.internetdomain.com.nt/virtualdirectory/FrontEndWS
对于 https
情况,您的网站将通过 Edit Bindings
选项映射443 https端口,并指定需要使用的服务证书。
此外,您还需要在web.config中使用端点定义服务。示例如下所示:
<bindings>
<basicHttpBinding>
<binding name="LargeMessagingBinding" maxBufferSize="99999900" maxBufferPoolSize="524288000" maxReceivedMessageSize="99999900">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="99999900" maxBytesPerRead="99999900" maxNameTableCharCount="2147483647" />
<security>
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="SampleWCFService.Service1" behaviorConfiguration="default">
<endpoint address="" behaviorConfiguration="ServiceBehaviour" binding="basicHttpBinding" bindingConfiguration="LargeMessageBinding" contract="SampleWCFService.IService1"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="6553600" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="false" />
检查上述配置中的服务元素。确保正确指定了服务的命名空间。
答案 1 :(得分:0)
我遇到了同样的问题,现在发现这是因为SSL卸载程序位于Web服务器的前面。请咨询您的管理员组。我们摆脱了SSL卸载,因为我们不得不提供服务。 您可以参考以下链接
http://blogs.msdn.com/b/distributedservices/archive/2010/05/13/wcf-and-intermediate-devices.aspx
还为https
添加主机标头http://www.sslshopper.com/article-ssl-host-headers-in-iis-7.html