SuperWebSocket icon indicating copy to clipboard operation
SuperWebSocket copied to clipboard

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in SuperWebSocket.dll

Open ismailkocacan opened this issue 10 years ago • 4 comments
trafficstars

  • I've create .net 3.5 project and download latest release from here https://www.nuget.org/packages/SuperWebSocketNETServer/0.8.0

using SuperSocket.SocketBase;
using SuperWebSocket;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebSocketServer2
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Press any key to start the WebSocketServer!");

            Console.ReadKey();
            Console.WriteLine();

            var appServer = new WebSocketServer();

            //Setup the appServer
            if (!appServer.Setup(2012)) //Setup with listening port
            {
                Console.WriteLine("Failed to setup!");
                Console.ReadKey();
                return;
            }

            appServer.NewMessageReceived += new SessionHandler(appServer_NewMessageReceived);

            Console.WriteLine();

            //Try to start the appServer
            if (!appServer.Start())
            {
                Console.WriteLine("Failed to start!");
                Console.ReadKey();
                return;
            }

            Console.WriteLine("The server started successfully, press key 'q' to stop it!");

            while (Console.ReadKey().KeyChar != 'q')
            {
                Console.WriteLine();
                continue;
            }

            //Stop the appServer
            appServer.Stop();

            Console.WriteLine();
            Console.WriteLine("The server was stopped!");
            Console.ReadKey();

        }


        static void appServer_NewMessageReceived(WebSocketSession session, string message)
        {
            //Send the received message back
            session.Send("Server: " + message);
        }

    }
}

When I project run then throwing FileNotFoundException ScreenShot

ismailkocacan avatar Oct 02 '15 08:10 ismailkocacan

I had the same issue. This issue is related to the log4net dependency. If you downloaded the library through NuGet it probably installed version 2.0.3 (file version 1.2.13.0) of log4net. This is the reason for the FileNotFoundException.

It seems that a previous version of log4net is actually required. According to the exception the server dll requires file version 1.2.11.0 of log4net (this provided by the v2.0.0 of log4net on NuGet).

If you downgrade the dependency it should work properly.

kelsos avatar Oct 19 '15 18:10 kelsos

@ismailkocacan, your screenshot is no longer visible. What was the assembly that couldn't be loaded? Was it log4net or something else?

thomaslevesque avatar Jan 20 '16 17:01 thomaslevesque

Check if you're missing SuperSocket.SocketEngine in your references.

vspin avatar Feb 21 '16 01:02 vspin

^ Was my problem.

vspin avatar Feb 21 '16 01:02 vspin