Silverlight通过ISA访问WCF服务
2011-10-27 15:54
405 查看
维护一个老程序,在用户增加ISA作为局域网与互联网之间的防火墙之后,在互联网上的用户就无法让页面中的silverlight访问WCF服务了,但在与服务器在同一个局域网中的用户使用照常。
使用ISA使得互联网的用户必须通过HTTPS协议访问防火墙后的WEB服务器,WCF服务host在其中,而ISA里面局域网中的用户直接使用HTTP协议来访问这个服务,ISA对HTTPS的转换是透明的。
最后的解决方案是服务端的配置不变,在silverlight的ServiceReferences.ClientConfig添加一个binding和endpoint,endpoint的address等与原有的endpoint相同,只是使用心得binding,而新的binding与原有的binding只是在security改为Transport——与HTTPS都应,在互联网用HTTPS访问服务时用新的endpoint就可以了。修改后并不是很难理解,但客户端与服务端配置不配对让人有些奇怪。
例子如下:
Web.conf中的相关配置
ServiceReferences.ClientConfig的相关配置
使用ISA使得互联网的用户必须通过HTTPS协议访问防火墙后的WEB服务器,WCF服务host在其中,而ISA里面局域网中的用户直接使用HTTP协议来访问这个服务,ISA对HTTPS的转换是透明的。
最后的解决方案是服务端的配置不变,在silverlight的ServiceReferences.ClientConfig添加一个binding和endpoint,endpoint的address等与原有的endpoint相同,只是使用心得binding,而新的binding与原有的binding只是在security改为Transport——与HTTPS都应,在互联网用HTTPS访问服务时用新的endpoint就可以了。修改后并不是很难理解,但客户端与服务端配置不配对让人有些奇怪。
例子如下:
Web.conf中的相关配置
<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> <behaviors> <serviceBehaviors> <behavior name="FPServiceBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> <serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" maxConcurrentInstances="1000"/> </behavior> </serviceBehaviors> </behaviors> <bindings> <basicHttpBinding> <binding name="basicHttpBinding_Service" openTimeout="01:10:00" receiveTimeout="01:10:00" sendTimeout="01:10:00" closeTimeout="01:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows"/> </security> </binding> </basicHttpBinding> </bindings> <services> <service behaviorConfiguration="FPServiceBehavior" name="WcfPlanningLibrary.PlanLine"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_FPService" contract="WcfPlanningLibrary.IPlanLine"> </endpoint> </service> <service behaviorConfiguration="ServiceBehavior" name="FPMVService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_FPService" contract="FPMVService"> </endpoint> </service> </services> </system.serviceModel>
ServiceReferences.ClientConfig的相关配置
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_Service" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" closeTimeout="00:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="TransportCredentialOnly" /> </binding> <binding name="BasicHttpBinding_Service1" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" closeTimeout="00:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="Transport" /> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://XXX/WCFWeb/Service.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Service" contract="Service.Service" name="BasicHttpBinding_Service" /> <endpoint address="https://XXX/WCFWeb/Service.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Service1" contract="Service.Service" name="BasicHttpBinding_Service1" /> </client> </system.serviceModel>其中BasicHttpBinding_Service1是新的binding和新的endpoint的名字。
相关文章推荐
- Silverlight跨域访问WCF服务
- 未能创建SSL/TLS安全通道,导致的通过HTTPS协议访问WCF服务
- Silverlight跨域访问WCF服务
- 解决 Silverlight 调用 WCF 服务 跨域访问 和 Silverlight 引用服务后配置文件不加载的问题
- Silverlight访问WCF服务时SoapHeader信息丢失
- Silverlight跨域访问WCF服务【转载】
- 解决 Silverlight 调用 WCF 服务 跨域访问 和 Silverlight 引用服务后配置文件不加载的问题
- ArcGIS API for Silverlight中通过https访问rest服务
- Silverlight访问WCF服务跨域问题
- 解决 Silverlight 调用 WCF 服务 跨域访问 和 Silverlight 引用服务后配置文件不加载的问题
- Silverlight通过TCP协议访问双工模式的WCF(Host在控制台)
- Android通过GET和POST方式访问WCF服务(Json)
- ArcGIS API for Silverlight中通过https访问rest服务(二)
- Silverlight访问Window服务为宿主的WCF跨域问题解决方案.
- Silverlight通过TCP协议访问双工模式的WCF(Host在控制台)
- silverlight如何通过单独部署的WCF站点访问sharepoint2013的图片库
- Silverlight通过Wcf Data Service访问数据库之ADO.NET Entity Framework篇
- ArcGIS API for Silverlight中通过https访问rest服务(三)
- Silverlight通过httpBinding访问IIS宿主WCF
- Silverlight与WCF通信(一) :Silverlight通过httpBinding访问IIS宿主WCF