locked
SignalR 2.2.2 RRS feed

  • Question

  • User1861596023 posted

    Hi

    I've been using SignalR 2.2.2 for a while.  It works fine with NewtonSoft.JSON 6.0.4 but whenever I try to move JSON to the latest version it still compiles OK but at runtime fails saying it is looking for the 6.0.4 version of the DLL (which isn't there as the installer is copying the correct 10.0.2 version instead). I added a binding redirect but it seems to ignore it.

         <dependentAssembly>

           <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />

            <bindingRedirect oldVersion="0.0.0.0-10.0.1.0" newVersion="10.0.2.0" />

          </dependentAssembly>

    At runtime on start of the app it errors saying it cant find the 6.0.4 DLL.

    What am I doing wrong?

    Regards

    Julian

    Friday, May 26, 2017 12:18 PM

All replies

  • User1861596023 posted

    ...I should also say that trying to debug this is driving me nuts!  Cry

    Friday, May 26, 2017 12:19 PM
  • User1967761114 posted

    Hi juwi_uk,

    I reproduced your case and test succeeds ,you could modify it like the following configuration:

    <dependentAssembly>
    
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
    
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
    
    </dependentAssembly>

    If you have any other questions, please feel free to contact me any time.

    Best Regards

    Even

    Monday, May 29, 2017 2:54 AM
  • User1861596023 posted

    Hi I am revisiting this one (having parked it for a while).

    I'm using the latest SignalR 2.2.2 version and JSON 10.0.3

    My application is .NET 4.6.1

    I am trying to self-host the server-side in a windows service.

    If I run the service (to debug it) as a console app, then the client connects to it fine; ie this in my main() method (sorry it's in VB :0) )

          If (Environment.UserInteractive) Then
                Dim myServ As New MyServerCode()
                myServ.OnStart(Nothing)
                Console.WriteLine("Services running in interactive mode")
                Console.ReadLine()
                myServ.OnStop()
            Else
                ServicesToRun = New System.ServiceProcess.ServiceBase() {New ComfortServer}
                System.ServiceProcess.ServiceBase.Run(ServicesToRun)
            End If

    OK, anyway all of this works fine.

    My APP manifest looks as per Even's post.

    Now instead recompile and install it as a service and the service fails to start

    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.IO.FileLoadException
       at Microsoft.AspNet.SignalR.DefaultDependencyResolver.RegisterDefaultServices()
       at Microsoft.AspNet.SignalR.DefaultDependencyResolver..ctor()
       at Microsoft.AspNet.SignalR.GlobalHost+<>c.<.cctor>b__13_0()
       at System.Lazy`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CreateValue()
       at System.Lazy`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].LazyInitValue()
       at System.Lazy`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Value()
       at Microsoft.AspNet.SignalR.GlobalHost.get_DependencyResolver()
       at ......

    Whilst not easy to debug,  it does start working if I downgrade JSON back to 6.0.4.

    I am left totally confused;  I don't want to run server on this version and client on later version for sure.

    Does the service not read the redirects in the manifest? 

         <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
          </dependentAssembly>

    I really could do with some help or pointers from the experts out there.

    Save me!!  :0)

    Julian

    Sunday, June 25, 2017 9:31 AM
  • User1861596023 posted

    OMG I solved my own question minutes after I posted this.  I've been banging my head on this for hours., Doh!

    Reason it doesn't work when installed as a service.....

    ..in my WIX installer I didn't copy over the ..exe.config file that has the binding directs in it!

    arggghhhh!  :0)

     

    Sunday, June 25, 2017 9:37 AM