WEB开发网
开发学院图形图像Flash [玩转Silverlight]第四回:基础篇,在Silverlight... 阅读

[玩转Silverlight]第四回:基础篇,在Silverlight中使用基于WCF的REST服务(下)

 2009-02-20 11:56:53 来源:WEB开发网   
核心提示: 配置web.config<system.serviceModel><services><service name="Anytao.SLScenario.Service.PostService"><endpoint address

  • 配置web.config

<system.serviceModel>
  <services>
    <service name="Anytao.SLScenario.Service.PostService">
      <endpoint address="" binding="webHttpBinding" contract="Anytao.SLScenario.Service.IPostService" behaviorConfiguration="postbehavior"/>
    </service>
  </services>
  <bindings>
    <webHttpBinding>
      <binding name="secure">
        <security mode="None">
        </security>
      </binding>
    </webHttpBinding>
  </bindings>
  <behaviors>
    <endpointBehaviors>
      <behavior name="postbehavior">
        <webHttp/>
      </behavior>
    </endpointBehaviors>
  </behaviors>
</system.serviceModel>

  • 添加跨域策略文件clientaccesspolicy.xml

<?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>

上一页  1 2 3 4 5  下一页

Tags:Silverlight 第四回 基础

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接