Вопрос Error 500 with 2 parameters filter

  • 23 мая 2012 г. 12:41
     
      С кодом

    Hi, I'm working on my second project with Sync FW 4.0.

    I have several scopes that work great, without any problem. Some of them have a filter clause on a column.

    Now I need to implement a scope with a filter based on 2 columns but I recieve an http 500 error.

    This is my config:
    [...]

    <SyncTable Name="[tbSedeCliente]" GlobalName="tbSedeCliente" SchemaName="" IncludeAllColumns="false" FilterClause="[side].idCommessa = @idCommessa AND [side].idEnte = @idEnte">
     <SyncColumns>
      <SyncColumn Name="idCommessa" GlobalName="idCommessa" SqlType="int" IsPrimaryKey="true" IsNullable="false" />
                    <SyncColumn Name="idEnte" GlobalName="idEnte" SqlType="int" IsPrimaryKey="true" IsNullable="false" />
                    <SyncColumn Name="codComune" GlobalName="codComune" SqlType="char" IsPrimaryKey="false" IsNullable="true" />
                    <SyncColumn Name="codEnte" GlobalName="codEnte" SqlType="varchar" IsPrimaryKey="false" IsNullable="false" />
                    <SyncColumn Name="nomeEnte" GlobalName="nomeEnte" SqlType="varchar" IsPrimaryKey="false" IsNullable="true" />
                    <SyncColumn Name="nomeEnte2" GlobalName="nomeEnte2" SqlType="varchar" IsPrimaryKey="false" IsNullable="true" />
                    <SyncColumn Name="indirizzo" GlobalName="indirizzo" SqlType="varchar"IsPrimaryKey="false" IsNullable="true" />
                    <SyncColumn Name="CAP" GlobalName="CAP" SqlType="varchar" IsPrimaryKey="false" IsNullable="true" />
                    <SyncColumn Name="comis" GlobalName="comis" SqlType="varchar" IsPrimaryKey="false" IsNullable="true" />
                    <SyncColumn Name="idcecos" GlobalName="idcecos" SqlType="varchar" IsPrimaryKey="false" IsNullable="true" />
                    <SyncColumn Name="codpres" GlobalName="codpres" SqlType="varchar" IsPrimaryKey="false" IsNullable="true" />
                    <SyncColumn Name="codsubpres" GlobalName="codsubpres" SqlType="varchar" IsPrimaryKey="false" IsNullable="true" />
                    <SyncColumn Name="datavar" GlobalName="datavar" SqlType="datetime" IsPrimaryKey="false" IsNullable="true" />
                    <SyncColumn Name="stato" GlobalName="stato" SqlType="bit" IsPrimaryKey="false" IsNullable="true" />
                    </SyncColumns>
                    <FilterColumns>
                     <FilterColumn Name="idCommessa" />
       <FilterColumn Name="idEnte" />
                    </FilterColumns>
                    <FilterParameters>
                     <FilterParameter Name="@idCommessa" SqlType="int" DataSize="0" />
                     <FilterParameter Name="@idEnte" SqlType="int" DataSize="0" />
                    </FilterParameters>
     </SyncTable>
    

    [...]

    This is my service code:

    config.AddFilterParameterConfiguration("idcommessa", "tbSedeCliente", "@idCommessa ", typeof(System.Int32));
    config.AddFilterParameterConfiguration("idente", "tbSedeCliente", "@idEnte", typeof(System.Int32));

    And this is the Url:
    http://192.168.0.10/tapsync/scopeImpegnativaSedeCliSyncService.svc/scopeimpegnativasedecli/DownloadChanges?idcommessa=710&idente=148

    And this is the data I post for the first sync:

    {"d":{"__sync":{"moreChangesAvailable":false,"serverBlob":""},"results":[]}}

    Where I'm wrong ?

    Thanks.

Все ответы

  • 24 мая 2012 г. 3:49
    Модератор
     
     
    try tracing so you can get a more detailed error...
  • 24 мая 2012 г. 9:43
     
      С кодом

    this is my trace: http://pastebin.com/1Std8Pne but I can't find nothing useful

    and this is how I configured tracing in web.config:

     <system.diagnostics>
        <sources>
          <source name="System.ServiceModel.MessageLogging" switchValue="Verbose,ActivityTracing">
            <listeners>
              <add type="System.Diagnostics.DefaultTraceListener" name="Default" />
              <add name="ServiceModelTraceListener" />
            </listeners>
          </source>
          <source name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
            <listeners>
              <add type="System.Diagnostics.DefaultTraceListener" name="Default" />
              <add name="ServiceModelTraceListener" />
    		</listeners>
          </source>
          <source name="System.Runtime.Serialization" switchValue="Verbose,ActivityTracing">
            <listeners>
              <add type="System.Diagnostics.DefaultTraceListener" name="Default" />
              <add name="ServiceModelTraceListener" />
            </listeners>
          </source>
        </sources>
        <sharedListeners>
          <add initializeData="App_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
            <filter type="" />
          </add>
        </sharedListeners>
      </system.diagnostics> 
    
        <system.serviceModel>
            <diagnostics>
                <messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true" />
            </diagnostics>
        </system.serviceModel>	

    Thanks

  • 24 мая 2012 г. 10:11
    Модератор
     
      С кодом

    have you configured sync in verbose mode?

    i.e.,

    config.UseVerboseErrors = true;
  • 24 мая 2012 г. 12:31
     
     

    First of all, thanks for help.

    I have configured the sync in verbose mode and now I can find this error:

    ErrorDescription=System.NullReferenceException
    Riferimento a un oggetto non impostato su un'istanza di oggetto.
       in Microsoft.Synchronization.Services.SqlProvider.SqlSyncProviderService.CreateNewScopeForClient()
       in Microsoft.Synchronization.Services.SqlProvider.SqlSyncProviderService.GetChanges(Byte[] clientKnowledgeBlob)
       in Microsoft.Synchronization.Services.DownloadChangesRequestProcessor.ProcessRequest(Request incomingRequest)
       in Microsoft.Synchronization.Services.SyncService`1.ProcessRequestForMessage(Stream messageBody)

  • 24 мая 2012 г. 12:42
    Модератор
     
     

    i notice you have two filter parameters but your service code above is only adding one parameter, did you just miss pasting it? or you did configure your service with one parameter only?

    can you confirm that the scope is created on the server database?

  • 24 мая 2012 г. 13:44
     
      С кодом

    The scope is created; I can also find it in the scope_templates table.

    Why you say that "service code above is only adding one parameter" ?  These two lines are not enough for adding two parameters ?

    config.AddFilterParameterConfiguration("idcommessa", "tbSedeCliente", "@idCommessa ", typeof(System.Int32)); config.AddFilterParameterConfiguration("idente", "tbSedeCliente", "@idEnte", typeof(System.Int32));

  • 25 мая 2012 г. 1:30
    Модератор
     
     

    for some reason, my browser doenst show the second line...

    since you have the code for the sync toolkit anyway, i suggest you reference the code and put a break on where it's firing the error...

    do you see any entry on the scope_parameters table as well?

  • 25 мая 2012 г. 7:41
     
     

    I can't find any entry (related to the 2 parameter scope) in the scope_parameters table.

    I'll try to find the exact point where the code "explodes" :)

    Meanwhile if you have any other ideas or suggestions..... Thanks