2016-06-30 10 views
1

Ich versuche, eine Sammlung an WCF zu senden. Wenn die Größe der Sammlung nicht so groß ist (z. B. Größe 10), wird normal gesendet. Wenn die Größe auf 400-500 vergrößert wird, habe ich einen Fehler, der besagt: "Der Remote-Server hat einen Fehler zurückgegeben: NotFound".Der Remote-Server hat einen Fehler zurückgegeben: NotFound, wenn ich eine Sammlung an WCF sende

Irgendwelche Vorschläge?

Der Fehler erscheint nach dieser Zeile:

wsClient.importFromExcelAsync(new System.Collections.ObjectModel.ObservableCollection(VIPcollection));

 private void buttonSendFile_Click(object sender, RoutedEventArgs e) 
    { 
     try 
     { 
      if (_fileName == null) 
      { 
       MessageBox.Show("..."); 
      } 

      else 
      { 
       var streamFile = UploadTagetsFile(_fileName, _fileStream).ToString(); 
       var linesSplit = streamFile.ToString().Split('$'); 
       bool isHeader = (bool)checkBoxIsHeader.IsChecked; 
       var splitFile = streamFile.Split('$'); 
       List<MgarIVR.VipCustomerService.VipCustomer> vipNewCollection = new List<VipCustomerService.VipCustomer>(); ; 

       foreach (var vip in splitFile) 
       { 
        if (isHeader) 
        { 
         isHeader = false; 
         continue; 
        } 
        var splitTarget = vip.Split(','); 
        try 
        { 
         if (IsDigitsOnly(splitTarget[1]) && IsDigitsOnly(splitTarget[2])) 
         { 

          var CustomerVip = new MgarIVR.VipCustomerService.VipCustomer(); 
          CustomerVip.CustomerName = splitTarget[0]; 
          CustomerVip.Phone1 = splitTarget[1]; 
          CustomerVip.Phone2 = splitTarget[2]; 
          CustomerVip.CustomerID = splitTarget[3]; 
          CustomerVip.Skill = splitTarget[4]; 
          CustomerVip.Priority = Int16.Parse(splitTarget[5]); 
          vipNewCollection.Add(CustomerVip); 


         } 


        } 
        catch (Exception ex) 
        { 
         LoggerService.LoggerServiceClient wslogClient = new LoggerService.LoggerServiceClient(); 
         wslogClient.WriteToLogAsync(ex.Message); 
        } 


       } 
       VIPcollection = vipNewCollection; 
       VipCustomerService.VipCustomerServiceClient wsClient = new VipCustomerService.VipCustomerServiceClient();     
       wsClient.importFromExcelAsync(new System.Collections.ObjectModel.ObservableCollection<MgarIVR.VipCustomerService.VipCustomer>(VIPcollection)); 
       wsClient.importFromExcelCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(wsClient_importFromExcelCompleted); 
      } 


     } 
     catch (Exception ex) 
     { 
      LoggerService.LoggerServiceClient wslogClient = new LoggerService.LoggerServiceClient(); 
      wslogClient.WriteToLogAsync(ex.Message); 
     } 
    } 

ServiceReference.ClientConfig:

<configuration> 
<system.serviceModel> 
    <bindings> 

     <binding> 
     <readerQuotas maxArrayLength="2147483647"/> 
     </binding> 
     <basicHttpBinding> 
      <binding name="BasicHttpBinding_ICDNservices" maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
       <security mode="None" /> 
      </binding> 
      <!--<binding name="BasicHttpBinding_IVipCustomerService" maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
       <security mode="None" /> 
      </binding>--> 
      <binding name="BasicHttpBinding_IVipCustomerService" maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
       <security mode="None" /> 
      </binding> 
      <binding name="BasicHttpBinding_IVoiceMessageService" maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
       <security mode="None" /> 
      </binding> 
      <binding name="BasicHttpBinding_ISpecialDaysService" maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
       <security mode="None" /> 
      </binding> 
      <binding name="BasicHttpBinding_IWeekDaysService" maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
       <security mode="None" /> 
      </binding> 
      <binding name="BasicHttpBinding_ILoggerService" maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
       <security mode="None" /> 
      </binding> 
      <binding name="BasicHttpBinding_ISkillService" maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
       <security mode="None" /> 
      </binding> 
     </basicHttpBinding> 
    </bindings> 


<client> 
    <endpoint address="http://localhost:54245/Services/SpecialDaysService.svc" 
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISpecialDaysService" 
    contract="SpecialDaysService.ISpecialDaysService" name="BasicHttpBinding_ISpecialDaysService" /> 
    <endpoint address="http://localhost:54245/Services/WeekDaysService.svc" 
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWeekDaysService" 
    contract="WeekDaysService.IWeekDaysService" name="BasicHttpBinding_IWeekDaysService" /> 
    <endpoint address="http://localhost:54245/Services/LoggerService.svc" 
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILoggerService" 
    contract="LoggerService.ILoggerService" name="BasicHttpBinding_ILoggerService" /> 
    <endpoint address="http://localhost:54245/Services/CDNservices.svc" 
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICDNservices" 
    contract="CDNservices.ICDNservices" name="BasicHttpBinding_ICDNservices" /> 
    <endpoint address="http://localhost:54245/Services/VoiceMessageService.svc" 
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IVoiceMessageService" 
    contract="VoiceMessageService.IVoiceMessageService" name="BasicHttpBinding_IVoiceMessageService" /> 
    <endpoint address="http://localhost:54245/Services/SkillService.svc" 
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISkillService" 
    contract="SkillService.ISkillService" name="BasicHttpBinding_ISkillService" /> 
    <endpoint address="http://localhost:54245/Services/VipCustomerService.svc" 
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IVipCustomerService" 
    contract="VipCustomerService.IVipCustomerService" name="BasicHttpBinding_IVipCustomerService" /> 
</client> 
</system.serviceModel> 

Web.Config:

<configuration> 

<!-- ================= Common(Misc) =================--> 
<add key="logo" value="C:\Development\C#\Integration..."/> 
<add key="CustomerLogoPath" value="C:\Development\C#\Integration..."/> 
<add key="DownloadsFolderVirtualPath" value="ExcelDownload"/> 
<add key="DownloadsFolderAbsolutePath" value="C:\Development\C#\Integration..."/> 
<add key="NeedCheckAuthorize" value="false"/> 
<add key="VoiceMessagePath" value="C:\Development\C#\Integration..."/> 

<system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
</system.web> 

<system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
      <behavior name=""> 
       <serviceMetadata httpGetEnabled="true" /> 
       <serviceDebug includeExceptionDetailInFaults="false" /> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
</system.serviceModel> 

+0

Wie sieht Ihre Konfiguration aussehen für die VipCustomerService ? Wenn Sie Dateien senden, treffen Sie möglicherweise eine Dateigrößenbeschränkung basierend auf den WCF-Dienstkonfigurationseinstellungen. – matt

+0

Ich habe meinen Post bearbeitet und 'ServiceReference.ClientConfig' und 'Web.Config' hinzugefügt. – David

Antwort

0

Sie messageEncoding als MtoM verwenden können.

   <binding messageEncoding="Mtom" ></binding> 

können Sie erhöhen die Puffergröße

 <binding maxBufferSize="2000000" name="basicHttp"></binding> 

Vielleicht möchten Sie auch die MaxArrayLength erhöhen

 <binding> 
     <readerQuotas maxArrayLength="2147483647"/> 
     </binding> 

Quelle: https://social.msdn.microsoft.com/Forums/vstudio/en-US/f5c53569-3969-42ba-af26-40740f306c08/difference-between-maxarraylength-and-maxreceivedmessagesize?forum=wcf

+0

Ich habe zu meinem Beitrag 'ServiceReference.ClientConfig' und 'Web.Config' – David

+0

Hallo, nachdem ich dies getan habe, habe ich diesen Fehler: "Unbekanntes Element 'messageEncoding' in Service-Referenz-Konfiguration. Beachten Sie, dass nur eine Teilmenge der Windows Communication Foundation Konfigurationsfunktionalität ist in Silverlight verfügbar. " – David

Verwandte Themen