“Photon.SocketServer.Configuration.PhotonSettings”

28408: 16:38:32.889 - ERROR: Failed to start application: "MyServerInit" in app domain: 2

20488: 16:38:32.890 - CManagedHost::OnDefaultAction() - OPR_AppDomainUnload - eUnloadAppDomain

28408: 16:38:32.890 - CService::OnException() - Exception: CManagedHost::StartApplication() - Failed to start application in AppDomain: 2 - “Photon.SocketServer.Configuration.PhotonSettings”的类型初始值设定项引发异常。

28408: 16:38:32.890 - Server shutting down...

28408: 16:38:32.890 - Shutdown monitoring enabled, 60000ms before process abort

28408: 16:38:32.890 - Notifying CLR applications of shutdown...

28408: 16:38:32.890 - RequestStop: defalt app domain

28408: 16:38:32.890 - Shutting down NEW TCP Outbound Connection Manager...

28408: 16:38:32.890 - Shutting down ENet host...

28408: 16:38:32.890 - Disconnecting all peers...

28408: 16:38:32.890 - Shutting down socket servers...

28408: 16:38:32.890 - Shutting down ENet thread pool...

28408: 16:38:32.891 - Shutting down TCP inactivity timers...

28408: 16:38:32.891 - Timer queue stats: TCP Timers

28408: 16:38:32.891 - Stats are not available

28408: 16:38:32.891 - Shutting down ENet timers...

28408: 16:38:32.891 - Waiting for socket servers to shutdown...

28408: 16:38:32.891 - Shutting down I/O thread pool...

28408: 16:38:32.891 - Shutting down CLR applications...

28408: 16:38:32.891 - Shutting down network data traces...

28408: 16:38:32.891 - Waiting for network data traces to complete...

28408: 16:38:32.891 - Destroying servers

28408: 16:38:32.891 - Destroying WebRTC Outbound Connection Manager

28408: 16:38:32.891 - Destroying WebRTC Outbound Host

28408: 16:38:32.891 - Destroying outbound ICE connection manager

28408: 16:38:32.891 - Destroying ENet timer wheel

28408: 16:38:32.891 - Timer queue stats: ENetTimerWheel

28408: 16:38:32.891 - Stats are not available

28408: 16:38:32.891 - Destroying Network Data Trace factory

28408: 16:38:32.891 - Destroying ENet host

28408: 16:38:32.891 - Destroying WebRTC inactivity timer queue

28408: 16:38:32.891 - Destroying WebRTC host

28408: 16:38:32.891 - Destroying ICE connection manager

28408: 16:38:32.891 - Flushing stream socket allocator...

28408: 16:38:32.891 - Flushing UDP Chunk datagram socket allocator...

28408: 16:38:32.891 - Flushing NEW TCP socket allocator...

28408: 16:38:32.891 - Destroying TCP inactivity timer

28408: 16:38:32.891 - Flushing ENET buffer allocator...

28408: 16:38:32.891 - Flushing TCP buffer allocator...

28408: 16:38:32.891 - Flushing TCP buffer handle allocator...

28408: 16:38:32.891 - Destroying CLR applications

28408: 16:38:32.891 - ~CCLRApplicationCollection() - Waiting up to 10 seconds for the CLR to release all of our objects

20488: 16:38:32.894 - CManagedHost::OnDomainUnload() - 2

28408: 16:38:32.894 - ~CCLRApplicationCollection() - Done. All objects released

28408: 16:38:32.894 - ~CManagedHost() - Release default app domain

28408: 16:38:32.894 - CManagedHost::OnDomainUnload() - 1

28408: 16:38:32.894 - ~CManagedHost() - Waiting up to 10 seconds for CLR shutdown...

28408: 16:38:32.906 - ~CManagedHost

28408: 16:38:32.906 - Destroying ENet thread pool

28408: 16:38:32.906 - Destroying I/O thread pool

28408: 16:38:32.906 - Destroying HTTP File Server I/O thread pool

28408: 16:38:32.906 - Destroying ENet I/O thread pool

28408: 16:38:32.906 - Destroying ENet buffer allocator

28408: 16:38:32.906 - Destroying TCP buffer allocator

28408: 16:38:32.906 - Destroying TCP socket allocator

28408: 16:38:32.906 - Destroying NEW TCP socket allocator

28408: 16:38:32.906 - Destroying NEW TCP configuration

28408: 16:38:32.906 - Config|INFO| New TCP: Flushing TCP socket allocator...

28408: 16:38:32.906 - Config|INFO| New TCP: Flushing TCP buffer allocator...

28408: 16:38:32.906 - Config|INFO| New TCP: Flushing TCP buffer handle allocator...

28408: 16:38:32.906 - Config|INFO| New TCP: Flushing policy file buffer allocator...

28408: 16:38:32.906 - Destroying UDP Chunk inbound socket allocator

28408: 16:38:32.906 - Destroying shared datagram flow control data

28408: 16:38:32.906 - Shutdown complete...

28408: 16:38:32.907 - Service shutting down: failed to start application. Errorcode: 108

28408: 16:38:33.293 - Service shut down complete

Comments

  • Eaer
    Eaer

    Hello,

    I've been reporting errors and can't start


  • hi, @Eaer

    do not return null from LoadConfiguration method. Return default configuration


    best,

    ilya

  • Eaer
    Eaer

    hell0:

    My development environment:

    • Windows 10 x64
    • Microsoft .NET Framework 4.8
    • Microsoft Visual Studio 2019

    Microsoft.Extensions.Configuration.Abstractions.dll The version 3.1.8 recommended by SDK is used

    Now the error is reported, and the version is wrong, Error reporting prompt:

    未能加载文件或程序集“Microsoft.Extensions.Configuration.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

    Where is the problem? I have found many ways to solve it. How to solve it

  • hello:

    I want to know how your first problem was solved, because I also had this problem.

    28408: 16:38:32.890 - CService::OnException() - Exception: CManagedHost::StartApplication() - Failed to start application in AppDomain: 2 - “Photon.SocketServer.Configuration.PhotonSettings”的类型初始值设定项引发异常。

  • @yaonian do not return null from LoadConfiguration method. Return default configuration

  • @yaonian btw have you encountered my second problem, or anything that may help to the issue?

  • I've had a similar problem, when I used 6.0.0, it showed 3.1.8.0, which I guess may have something to do with the version you used.

  • hi, @Eaer and @yaonian

    Not sure why this happens. However there is a trick that you can use.

    please check your Photon.LoadBalancing.dll.config. it should contains stuff like this:

        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.1.8.0" newVersion="3.1.8.0" />
          </dependentAssembly>
        </assemblyBinding>
    

    you need to add such entries in case the are missing.

    if you need to use version 6.0.0 or any above just update such entries so that correct assembly redirect happens

    best,

    ilya

  • Photon.LoadBalancing.dll.config How is this file generated If my project is a new project, whether it can be used, I see the document only says that it needs to be added, how to add it, and how to add it to my new project is a problem

  • hi, @Eaer

    Photon.LoadBalancing.dll.config is auto generated file. it is generated by compiler basing on App.config. You have to add it (App.config) to your project. also please add next settings to your project file:

        <CopyLocalLockFileAssemblies>True</CopyLocalLockFileAssemblies>
        <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
        <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    


    best,

    ilya