无法在WCF服务中上传50 KB以上的文件?

时间:2016-10-13 12:00:52

标签: asp.net web-services wcf

下面给出了WCF服务中的web.config文件。

<?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.diagnostics>
        <sources>
          <source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
            <listeners>
              <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                <filter type="" />
              </add>
              <add name="ServiceModelTraceListener">
                <filter type="" />
              </add>
            </listeners>
          </source>
        </sources>
        <sharedListeners>
          <add initializeData="c:\tfslatest\entermarkets\project specific\psbd\trunk\smartincident\pss.web.services.internal\web_tracelog.svclog"
            type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
            <filter type="" />
          </add>
        </sharedListeners>
      </system.diagnostics>
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
        <!--                                  -->
        <!-- *** DATABASE ***                 -->
        <!--                                  -->
        <add key="Db Timeout Seconds" value="200" />
        <add key="Enable SMS" value="true" />
        <add key="Enable Notification" value="true" />
        <add key="K2 Server" value="EM-K2" />
        <add key="Forgot Password External Url" value="http://localhost/PSS.Web/ResetPassword.aspx?id=" />
        <add key="Incident Mobile Download Url" value="http://localhost/PSS.Web/DownloadApp.aspx?id=" />
      </appSettings>
      <system.web>

        <compilation targetFramework="4.5" debug="true" />

        <httpRuntime maxRequestLength="2097151" 
        useFullyQualifiedRedirectUrl="true"
        executionTimeout="14400"   />
      </system.web>
      <system.serviceModel>    

        <bindings>

          <webHttpBinding>
            <binding name="AttachmentService"
           maxReceivedMessageSize="2147483647"
           maxBufferSize="2147483647" transferMode="Streamed" >

              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                   maxArrayLength="2147483647" maxBytesPerRead="2147483647"
                   maxNameTableCharCount="2147483647"/>
            </binding>
          </webHttpBinding>
          <basicHttpBinding>
            <binding name="BasicHttpBinding_INotificationService" />
          </basicHttpBinding>
        </bindings>
        <client>
          <endpoint address="http://localhost/Utility.Notification.Service/NotificationService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INotificationService" contract="INotificationService" name="BasicHttpBinding_INotificationService" />
          <endpoint address="http://localhost/PSS.Web.Services.Internal/AttachmentService.svc" binding="basicHttpBinding"
              bindingConfiguration="AttachmentService"
              contract ="IAttachmentService">
          </endpoint>
        </client>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <protocolMapping>
          <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>
        <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />    
      </system.serviceModel>
      <!--<security>
        <requestFiltering>
          <requestLimits maxAllowedContentLength="2147483648" />
        </requestFiltering>
      </security>-->
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
        <!--
            To browse web app root directory during debugging, set the value below to true.
            Set to false before deployment to avoid disclosing web app folder information.
          -->
        <!--<directoryBrowse enabled="true" />
            <security>
                <authentication>
                    <windowsAuthentication enabled="true" />
                </authentication>
            </security>-->
        <directoryBrowse enabled="true" />
            <security>
                <requestFiltering>
                    <requestLimits maxAllowedContentLength="2147483648" maxUrl="2147483648" maxQueryString="2147483648" />
                </requestFiltering>
            </security>
      </system.webServer>
      <connectionStrings>
        <add name="Conn_PSBDDb" connectionString="DATA SOURCE=192.168.0.100:1521/orcl;USER ID=PSBD;Password=password*1;" providerName="Oracle.ManagedDataAccess.Client" />
      </connectionStrings>
    </configuration>    

这是服务器端配置文件

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
   -->
<configuration>

  <appSettings>  

    <!--                                  -->
    <!-- *** PLUG-IN CONFIGURATION ***    -->
    <!--                                  -->  

    <!-- Plug-In Collection -->
    <!-- Format for each entry is <Type>#<Assembly> -->
    <add key="AD Authentication PlugIn Evaluation List" value="PSS.AD.Adapters.NonMemberServer.NonMemberServerManager#PSS.AD.Adapters.NonMemberServer" />
    <add key="Login Url" value="http://localhost/PSS.Web/Login.aspx" />
    <add key="Forgot Password External Url" value="http://localhost/PSS.Web/ResetPassword.aspx?id=" />
    <add key="Incident Mobile Download Url" value="http://localhost/PSS.Web/DownloadApp.aspx?id=" />
    <add key="PSS Url" value="http://localhost/PSS.Web/" />

    <!--<add key="Templates Url" value="C:\TFS\EnterMarkets\Project Specific\PSBD\Trunk\SmartIncident\PSS.Web.Services.Internal\bin\MessageTemplates" />-->
    <add key="Templates Url" value="\\192.168.0.243\psbd\PSS.Web.Services.Internal\bin\MessageTemplates" />

    <add key="Hyper Pay URL" value="https://test.oppwa.com/" />
    <add key="Hyper Pay UserId" value="8a829417527905e80152794f55950197" />
    <add key="Hyper Pay Password" value="e2XRrKJa" />
    <add key="Hyper Pay EntityId" value="8a829417527905e80152794f8af10199" />


    <add key="Hyper Pay PaymentType" value="DB" />

    <!--For testing it must be 'EXTERNAL' else change to 'INTERNAL' as per documentation-->
    <add key="Hyper Pay Test Mode" value="EXTERNAL" />

    <!--                                  -->
    <!-- *** DATABASE ** *                -->
    <!--                                  -->
    <add key="Db Timeout Seconds" value="200" />

    <!--                                  -->
    <!-- *** LOGGING ***                  -->
    <!--                                  -->
    <add key="EnableLogging" value="false" />
    <add key="LogFilePath" value="C:\Temp\Logs\PSS.Web.log" />

    <add key="Enable SMS" value="true" />

    <add key="Enable Notification" value="true" />

    <add key="Domain Name" value="coruscant" />

    <add key="EnableExamExecution" value="false" />


    <!--
            If "EnableLogging" is set to true, this integer
            specifies the max size in bytes which the log file can be until it will
            be purged on next write to the log file
            Default value: 100000000
        -->

    <add key="Attachment Plug-In List" value="PSS.Core.Attachment.Adapters.FileServer.FileServerManager#PSS.Core.Attachment.Adapters.FileServer" />

    <add key="MaxLogFileSize" value="100000000" />

    <!-- Event Log Logging -->
    <add key="EventLogSourceName" value="PSS.Web" />
    <add key="ClientSettingsProvider.ServiceUri" value="" />
    <add key="language" value="ar" />
    <add key="FilestorePath" value="C:\Filestore\" />

    <!--Phisical Paths-->
    <add key="C:\TFS\EnterMarkets\Project Specific\PSBD\Trunk\SmartIncident\PSS.Web" value="" />
    <add key="UploadedFiles" value="C:\TFS\EnterMarkets\Project Specific\PSBD\Trunk\SmartIncident\PSS.Web\UploadedFiles\" />
    <!--/Phisical Paths-->

  </appSettings>

  <system.web> 
    <customErrors mode="Off" defaultRedirect="~/ErrorPage.aspx" redirectMode="ResponseRewrite"></customErrors>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime maxRequestLength="2097150"/>

  </system.web>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483647" />        
      </webServices>
    </scripting>
  </system.web.extensions>


  <connectionStrings>
    <add name="Conn_PSBDDb" connectionString="DATA SOURCE=192.168.0.100:1521/ORCL;USER ID=PSBD;Password=password*1;" providerName="Oracle.ManagedDataAccess.Client" />

  </connectionStrings><!---->

  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2147483648" maxUrl="2147483648" maxQueryString="2147483648" />
      </requestFiltering>
    </security>
    <!--<modules runAllManagedModulesForAllRequests="true">
      <remove name="BundleModule" />22
      <add name="BundleModule" type="System.Web.Optimization.BundleModule" />
    </modules>-->
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <staticContent>
      <!--
      <remove fileExtension=".svg" />
      <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
      <remove fileExtension=".svgz" />
      <mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />

      <remove fileExtension=".eot" />
      <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
      <remove fileExtension=".otf" />
      <mimeMap fileExtension=".otf" mimeType="font/otf" /> -->
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".woff" mimeType="font/x-woff" />
      <remove fileExtension=".woff2" />
      <mimeMap fileExtension=".woff2" mimeType="font/x-woff" />
      <remove fileExtension=".mp4" />
      <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
      <!--
      <mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive" />
      <mimeMap fileExtension=".ipa" mimeType="application/octet-stream" /> -->

    </staticContent>
    <directoryBrowse enabled="true" />
  </system.webServer>

  <system.serviceModel>    
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IADService" />
        <binding name="BasicHttpBinding_IWorkFlowService" />
        <binding name="BasicHttpBinding_INotificationService" />
        <!--<binding name="BasicHttpBinding_IAttachmentService" />-->
        <binding name="BasicHttpBinding_IAttachmentService" closeTimeout="04:01:00" openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed" useDefaultWebProxy="true">
          <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://192.168.0.245/PSS.AD.Web.Services/ADService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IADService" contract="ADWebService.IADService" name="BasicHttpBinding_IADService" />
      <endpoint address="http://192.168.0.242/PSS.Web.Services.Internal/WorkFlowService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWorkFlowService" contract="PSSWorkFlowService.IWorkFlowService" name="BasicHttpBinding_IWorkFlowService" />
      <endpoint address="http://localhost/Utility.Notification.Service/NotificationService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INotificationService" contract="INotificationService" name="BasicHttpBinding_INotificationService" />
      <endpoint address="http://localhost/PSS.Web.Services.Internal/AttachmentService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAttachmentService" contract="AttachmentsService.IAttachmentService" name="BasicHttpBinding_IAttachmentService" />
    </client>
  </system.serviceModel>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

我无法上传更多50KB文件,小于50kb工作正常我得到的异常是(远程服务器返回意外响应:(400)错误请求。)。任何帮助都可以得到赞赏。谢谢!

0 个答案:

没有答案