zoukankan      html  css  js  c++  java
  • Silverlight :服务器返回错误: NotFound 错误

    今天用Silverlight+wcf上传文件的时候发现读入的流字节只要大于16384B就会报 server returned an error: NotFound 错误

    解决办法是修改web.config文件

    注意27到34 行就可以了

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
      有关如何配置 ASP.NET 应用程序的详细信息,请访问
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
        <system.web>
            <compilation debug="true" targetFramework="4.0" />
        </system.web>
        <system.serviceModel>
            <behaviors>
                <serviceBehaviors>
                    <behavior name="">
                        <serviceMetadata httpGetEnabled="true" />
                        <serviceDebug includeExceptionDetailInFaults="false" />
                        <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
                    </behavior>
                </serviceBehaviors>
            </behaviors>
            <bindings>
                <customBinding>
                    <binding name="Service.customBinding0">
                        <binaryMessageEncoding />
                        <httpTransport />
                    </binding>
                    <binding name="UpFileService.customBinding0">
                        <binaryMessageEncoding>
                            <readerQuotas maxArrayLength="2097152"/>
                            <!--2MB-->
                        </binaryMessageEncoding>
                        <httpTransport maxReceivedMessageSize="2147483647"/>
                    </binding>
                </customBinding>
            </bindings>
            <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
       multipleSiteBindingsEnabled="true" />
            <services>
                <service name="Service">
                    <endpoint address="" binding="customBinding" bindingConfiguration="Service.customBinding0"
                     contract="Service" />
                    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                </service>
                <service name="UpFileService">
                    <endpoint address="" binding="customBinding" bindingConfiguration="UpFileService.customBinding0"
                     contract="UpFileService" />
                    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                </service>
            </services>
        </system.serviceModel>
        <system.webServer>
            <directoryBrowse enabled="true" />
        </system.webServer>
    </configuration>
    1 <?xml version="1.0" encoding="UTF-8"?>
    2  <!--
    3 有关如何配置 ASP.NET 应用程序的详细信息,请访问
    4 http://go.microsoft.com/fwlink/?LinkId=169433
    5 -->
    6  <configuration>
    7 <system.web>
    8 <compilation debug="true" targetFramework="4.0" />
    9 </system.web>
    10 <system.serviceModel>
    11 <behaviors>
    12 <serviceBehaviors>
    13 <behavior name="">
    14 <serviceMetadata httpGetEnabled="true" />
    15 <serviceDebug includeExceptionDetailInFaults="false" />
    16 <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    17 </behavior>
    18 </serviceBehaviors>
    19 </behaviors>
    20 <bindings>
    21 <customBinding>
    22 <binding name="Service.customBinding0">
    23 <binaryMessageEncoding />
    24 <httpTransport />
    25 </binding>
    26 <binding name="UpFileService.customBinding0">
    27 -----------------------------------------------------------------
    28 这一部分就是需要修改的部分:注意对应你的文件上传服务
    29 <binaryMessageEncoding>
    30 <readerQuotas maxArrayLength="2097152"/>
    31 <!--2MB-->
    32 </binaryMessageEncoding>
    33 <httpTransport maxReceivedMessageSize="2147483647"/>
    34 -----------------------------------------------------------------
    35 </binding>
    36 </customBinding>
    37 </bindings>
    38 <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
    39 multipleSiteBindingsEnabled="true" />
    40 <services>
    41 <service name="Service">
    42 <endpoint address="" binding="customBinding" bindingConfiguration="Service.customBinding0"
    43 contract="Service" />
    44 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    45 </service>
    46 <service name="UpFileService">
    47 <endpoint address="" binding="customBinding" bindingConfiguration="UpFileService.customBinding0"
    48 contract="UpFileService" />
    49 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    50 </service>
    51 </services>
    52 </system.serviceModel>
    53 <system.webServer>
    54 <directoryBrowse enabled="true" />
    55 </system.webServer>
    56  </configuration>
  • 相关阅读:
    01数据结构——绪论
    07机器学习实战k-means
    OpenJudge 2756 二叉树
    Poj/OpenJudge 1094 Sorting It All Out
    OpenJudge 2811 熄灯问题 / Poj 1222 EXTENDED LIGHTS OUT
    OpenJudge/Poj 1083 Moving Tables
    OpenJudge 2810(1543) 完美立方 / Poj 1543 Perfect Cubes
    Poj/OpenJudge 1042 Gone Fishing
    Poj 1013 Counterfeit Dollar / OpenJudge 1013(2692) 假币问题
    Poj 1017 / OpenJudge 1017 Packets/装箱问题
  • 原文地址:https://www.cnblogs.com/pipizhu/p/1774439.html
Copyright © 2011-2022 走看看