0

画像のzipファイルをftpサーバーにアップロードする1つのWindows Phoneアプリケーションを開発しています。しかし、私はそれをアップロードすることはできません。エラーが発生しますリモートサーバーが見つかりません

ここに私のWCFアプリケーションweb.configがあります

<?xml version="1.0"?>
<configuration>

 <appSettings>
       <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="409600" />   
</system.web>
<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <!--<binding maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" receiveTimeout="00:10:00" closeTimeout="00:10:00">
      <security mode="None" />
    </binding>-->
    <binding closeTimeout="01:30:00" 
      openTimeout="01:30:00" receiveTimeout="01:30:00" sendTimeout="01:30:00" 
      maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646">
      <readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" maxArrayLength="2147483646"
        maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" /> 
      <security mode="None">             
      </security>
    </binding>    
  </basicHttpBinding>    
</bindings>   

<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="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
 <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>

ここに私のServiceReferences.ClientConfigがあります

<configuration>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IService1" maxBufferSize="2147483647" closeTimeout="01:10:00"
                    openTimeout="01:10:00" receiveTimeout="01:10:00" sendTimeout="01:10:00" maxReceivedMessageSize="2147483647">
                <security mode="None" />
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://xxx.xx.x.xxx/WebService/Service1.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
            contract="MyService.IService1" name="BasicHttpBinding_IService1" />
    </client>
</system.serviceModel>

私は 2 つのプロジェクトを作成しました。1 つは Windows Phone アプリケーションで、もう 1 つは wcf アプリケーションです。大きなbyte[]配列を wcf サーバーに送信すると、エラーRemote server Notfoundが発生します。サイズが小さいときbyte[] sizeは問題なく動作しますが、サイズが大きいときは失敗します。約4GB近くの非常に大きなファイルをwcfサービスに送信できると聞きました。では、どこが間違っていたのでしょうか。web.configで行う必要がある変更はありますか? ローカル マシン上にIIShostedの wcf サービスがあります。

4

1 に答える 1

0

wcf 経由で大きなデータを送信するには、次の 2 つのオプションがあります。

  1. データを手動で断片に分割し (または、たとえばファイルから 2Kb ずつ読み取る)、各断片を個別に転送することができます。サーバー側では、各ピースを一時ファイルに保存できます。この方法では、いくつかのコーディングが必要です (たとえば、部分の制御順序)。

  2. 別のオプションはtransferMode="Streamed"を使用することですが、このモードにはいくつかの制限があります。

アップデート

何らかの理由でストリーミング モードを使用できない場合は、サービスでいくつかのメソッドを作成できます。

string BeginSendFile();

このメソッドは、id (たとえば Guid) を生成し、それをクライアントに返す必要があります。また、サービスはこの名前で一時ストレージにファイルを作成する場合があります。

void SendFilePortion(string id, byte[] data);

このメソッドを呼び出して、小さなデータを転送します。サーバーは ID で一時ファイルを見つけて、そこにデータを書き込むことがあります。

void EndSentFile(string id, string originalName);

すべてのデータを転送するときにこのメソッドを呼び出して、一時ファイルの名前を変更し、非一時ストレージに置き換えます。

于 2013-09-25T06:27:49.907 に答える