Fork me on GitHub

WCF上传大文件配置

WCF配置文件-Web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="db" value="Data Source=192.168.1.170;Initial Catalog=WSSExtend;User ID=sa;Password=123456" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
    <httpRuntime maxRequestLength="2097151" />
  </system.web>
  <system.serviceModel>
    <!--解决大文件上传NotFound问题-->
    <bindings>
      <basicHttpBinding>
        <binding name="BBB" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <!--name=随意命名,但要与上面的bindingConfiguration="BBB"对应 -->
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
          <security mode="None"></security>
        </binding>
        <binding name="CoreBBB" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
          <security mode="None"></security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点 -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 -->
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
        <!--解决大文件上传NotFound问题-->
        <!--注:此处的name值要跟下面的behaviorConfiguration值对应-->
        <behavior name="A">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
        <behavior name="CoreA">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <!--解决大文件上传NotFound问题-->
    <services>
      <!--注1:此处的behaviorConfiguration值要跟上面的name值对应-->
      <!--注2:此处的name值不能随便修改,命名格式为:完全命名空间+类名 -->
      <service behaviorConfiguration="A" name="DataService.TaskService">
        <!--注1:此处的contract值不能随便修改,命名格式为:完全命名空间+类名 -->
        <!--注2:此处的bindingConfiguration值要与下面 binding name中的name值对应-->
        <endpoint address="" bindingConfiguration="BBB" binding="basicHttpBinding" contract="DataService.ITaskService" />
      </service>
      <service behaviorConfiguration="CoreA" name="DataService.CoreService">
        <endpoint address="" bindingConfiguration="CoreBBB" binding="basicHttpBinding" contract="DataService.ICoreService" />
      </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <directoryBrowse enabled="true" />
  </system.webServer>
  <connectionStrings>
    <add name="WSSExtendEntities" connectionString="metadata=res://*/WSSExtendModel.csdl|res://*/WSSExtendModel.ssdl|res://*/WSSExtendModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=192.168.1.170;Initial Catalog=WSSExtend;Persist Security Info=True;User ID=sa;Password=123456;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

 

Silverlight跨域配置文件-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>

 

 

posted @ 2012-11-12 16:09  Nick.Chung  阅读(267)  评论(0编辑  收藏  举报