“启用了Silverlight的WCF服务”应该怎样发布
“启用了Silverlight的WCF服务”应该怎样发布?
情况:
解决方案中有一个“asp.net站点”,一个“Silverlight”项目,用“启用了Silverlight的WCF服务”提供数据服务。
配置:
1、IIS6.0/7.5,MIME类型配置正确,“XAP文件”正常显示。
2、跨域访问文件,如下:
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
3、“crossdomain.xml”文件
根目录下又放置了“crossdomain.xml”文件:
<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" />
<site-control permitted-cross-domain-policies="all" />
<allow-http-request-headers-from domain="*" headers="*" />
</cross-domain-policy>
4、节点配置(VS2010)自动生成
Silverlight客户端:
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_ChartsService">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
<binding name="CustomBinding_ChartsService1">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:2686/Mycems.UI/ChartsService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_ChartsService"
contract="ChartsService.ChartsService" name="CustomBinding_ChartsService" />
<endpoint address="http://localhost:4707/Mycems.UI/ChartsService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_ChartsService1"
contract="MyChartsService.ChartsService" name="CustomBinding_ChartsService1" />
</client>
</system.serviceModel>
</configuration>
服务器端(Web.config): <behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="ChartsService">
<endpoint address="" binding="customBinding" bindingConfiguration="ChartsService.customBinding0"
contract="ChartsService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpB