将大型文件从android上传到c#WCF Rest服务

将大型文件从android上传到c#WCF Rest服务,c#,android,wcf,file-upload,C#,Android,Wcf,File Upload,我正在开发一个android应用程序,我可以将视频、音频和图像从android设备上传到WCF REST服务。它完美地上传了一个10MB大小的视频文件,但当我试图上传一个1GB大小的视频文件时,它并没有上传到服务器。我想制作一个应用程序,在这个应用程序中,我可以将文件大小从3gb上传到4gb。我如何实现这一点?请任何人指导我实现这个方案 wcf服务代码: public string PostImage(Stream stream) { MultipartParser parser

我正在开发一个android应用程序,我可以将视频、音频和图像从android设备上传到WCF REST服务。它完美地上传了一个10MB大小的视频文件,但当我试图上传一个1GB大小的视频文件时,它并没有上传到服务器。我想制作一个应用程序,在这个应用程序中,我可以将文件大小从3gb上传到4gb。我如何实现这一点?请任何人指导我实现这个方案

wcf服务代码:

public string PostImage(Stream stream)
        {
MultipartParser parser = new MultipartParser(stream);

            if (parser.Success)
            {
                string fileName = parser.Filename;
                string contentType = parser.ContentType;
                byte[] fileContent = parser.FileContents;
                FileStream fileToupload = new FileStream("D:\\FileUpload\\" + fileName, FileMode.Create);
                fileToupload.Write(fileContent, 0, fileContent.Length);
                fileToupload.Close();
                fileToupload.Dispose();
                stream.Close();
                return "Success !!!";
            }
            else
            {
                return "Exception!!!";
            }
        }
web.config文件:

<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <services>
      <service name="Upload.Service1" behaviorConfiguration="default">
        <endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="RestBinding" name="Service1" contract="Upload.IService1" />
      </service>   
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp/>
        </behavior> 
      </endpointBehaviors>

      <serviceBehaviors>
        <behavior name="default">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />

          <!-- 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>
    <bindings>
      <webHttpBinding>
        <binding name="RestBinding"  maxReceivedMessageSize="2147483647"  maxBufferSize="2147483647">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="544096" />
          <security mode="None">
          </security>
        </binding>

      </webHttpBinding>
    </bindings>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <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"/>
  </system.webServer>

</configuration>
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httpost = new HttpPost("http://192.169.3.34/Service1.svc/upload");
        MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
        entity.addPart("fileContents", new FileBody(new File("/mnt/sdcard/hi.mp4")));
        httpost.setEntity(entity);
        HttpResponse response;
        response = httpclient.execute(httpost);
当我试图上传一个1GB的文件时,我得到的状态码是404


我需要进行更改,使我的代码上载到2gb到5gb的文件大小。有人能帮我解决这个问题吗。

您是否确保允许在iisSite->Request Filtering->Edit Feature Settingshow中进行大上传确保在IIS中进行大上传您能告诉我怎么做吗我编辑了功能设置,但无法上传1GB文件。如何将我的应用程序设置为无限制文件上载。要执行无限制上载,您应该一次发送文件块,而不是整个流。