Skip to content

按照 1.6.6.1 文档中的示例运行得到 Failed to initialize! #823

@zzdwugouzi

Description

@zzdwugouzi

我真的搞不明白到底为什么 Failed to initialize!,什么报错信息也找不到,什么提示都没有

我到底应该如何配置 server name="receiver" serverType="message.receiver.Programs, receiver" 这两个内容呢?

Program.cs

using SuperSocket.SocketBase;
using SuperSocket.SocketEngine;
using System;

namespace receiver
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var bootstrap = BootstrapFactory.CreateBootstrap();

            if (!bootstrap.Initialize())
            {
                Console.WriteLine("Failed to initialize!");
                Console.ReadKey();
                return;
            }

            var result = bootstrap.Start();

            Console.WriteLine("Start result: {0}!", result);

            if (result == StartResult.Failed)
            {
                Console.WriteLine("Failed to start!");
                Console.ReadKey();
                return;
            }

            Console.WriteLine("Press key 'q' to stop it!");

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

            Console.WriteLine();

            //Stop the appServer
            bootstrap.Stop();

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

App.config

<?xml version="1.0"?>
<configuration>
	<configSections>
		<section name="superSocket" type="SuperSocket.SocketEngine.Configuration.SocketServiceConfig, SuperSocket.SocketEngine"/>
	</configSections>

	<superSocket disablePerformanceDataCollector="true" maxWorkingThreads="500" maxCompletionPortThreads="500" minWorkingThreads="5" minCompletionPortThreads="5">
		<servers>
			<server name="receiver" serverType="message.receiver.Programs, receiver" ip="Any" port="5000" clearIdleSession="true" clearIdleSessionInterval="120" idleSessionTimeOut="300" maxConnectionNumber="500">
			</server>
		</servers>
	</superSocket>
	
	<startup>
		<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
	</startup>
</configuration>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions