GithubHelp home page GithubHelp logo

我真有点搞不懂 about freeim HOT 14 OPEN

2881099 avatar 2881099 commented on July 23, 2024
我真有点搞不懂

from freeim.

Comments (14)

2881099 avatar 2881099 commented on July 23, 2024

你需要注意,Server/Servers 和 dotnet 参数 --urls 要对应

from freeim.

sfindme avatar sfindme commented on July 23, 2024

您帮我看下,我这些配置参数是否正确
我配置发布在服务器上的信息
服务器IP地址:91.208.206.38
IMServer的appsettings.json参数如下:
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",

"ImServerOption": {
"RedisClient": "127.0.0.1:6379,poolsize=10",
"Servers": "91.208.206.38:6001",
"Server": "91.208.206.38:6001"
}
}
IMServer的launchSettings.json参数如下:
{
"profiles": {
"imServer": {
"commandName": "Project",
"commandLineArgs": "--urls=http://91.208.206.38:6001"
}
}
}
以上参数配置我发布到服务器上运行打开显示如图
1

WebApi那么不部署服务器应该也是可以的,我就在本地调试运行

WebApi我在本地代码调试来连接我的91.208.206.38的IMServer服务
WebApi配置初始化参数

ImHelper.Initialization(new ImClientOptions
{
Redis = new FreeRedis.RedisClient("91.208.206.38:6379,poolsize=10"),
Servers = new[] { "91.208.206.38:6001" }
});
运行结果如图
4

Redis配置是正确的,为什么呢,如果Redis连接不上,那么WebApi是会报错的。没报错,说明Redis是正确的

麻烦帮我看下,我哪里配置错了?谢谢。

from freeim.

sfindme avatar sfindme commented on July 23, 2024

即使我把WebApi部署到91.208.206.38:80或者91.208.206.38:6001

都是一样的错误
testindex.html:66 WebSocket connection to 'ws://91.208.206.38:6001/ws?token=b925182cd3bb4a77a6a1f432edb558242d775c950a864ea1904c99103f1222325fe3fab090984e1bbd19cd00226971ec87d7a287a5c2437985ae5a60ae1fd217' failed:

from freeim.

sfindme avatar sfindme commented on July 23, 2024

怎么配都不正确啊,这组合我都配烂了

from freeim.

sfindme avatar sfindme commented on July 23, 2024

我发布了,运行,为什么都是http://localhost:5000
IMServer信息都是:
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: D:\FreeMi\IMServer

from freeim.

sfindme avatar sfindme commented on July 23, 2024

不管我怎么改,发布运行都是下面的提示
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5000/

from freeim.

sfindme avatar sfindme commented on July 23, 2024

原来是我的服务器没开5000端口,防火墙我是没开,服务商没开5000

from freeim.

2881099 avatar 2881099 commented on July 23, 2024

耐心一些,总共只有几个配置

IMServer的launchSettings.json参数如下:
{
"profiles": {
"imServer": {
"commandName": "Project",
"commandLineArgs": "--urls=http://91.208.206.38:6001/"
}

但是你反馈的日志是 localhost:5001 说明配置没有生效

from freeim.

sfindme avatar sfindme commented on July 23, 2024

是不支持windows server 2012版本的服务器吗?
IMServer的launchSettings.json参数如下:
{
"profiles": {
"imServer": {
"commandName": "Project",
"commandLineArgs": "--urls=http://91.208.206.38:6001/"
}
这个我肯定是配置了的

from freeim.

DeliciousExtra avatar DeliciousExtra commented on July 23, 2024

@sfindme 兄弟你可以看下你的IIS有没有开websockt协议支持,我今天也遇到这个问题了,结果就是IIS 没开ws协议支持,你看下这https://learn.microsoft.com/zh-cn/iis/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support

from freeim.

sfindme avatar sfindme commented on July 23, 2024

我安装了的,安装完就可以了吧?还需要手动配置吗?

from freeim.

sfindme avatar sfindme commented on July 23, 2024

老哥你弄好了?

from freeim.

sfindme avatar sfindme commented on July 23, 2024

终于搞定了,三个关键点
1.服务器要安装WebSocket协议,开放端口,服务商的,服务器的都要开。

2.生成的时候有可能生成了三个配置文件,导致不一样,部署到服务器的时候,使用的是appsettings.Production.json,所需要改这个文件里面的IP和端口,才能一致,三个都改一下,都试试。
appsettings.Production.json
appsettings.json
appsettings.Development.json

3.launchSettings.json设置不生效的时候,需要手动设置端口在
IMServer的Program.cs文件中。

Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup()
.UseUrls("http://*:6001"); //直接指定端口;
});

from freeim.

1031918012 avatar 1031918012 commented on July 23, 2024

image
后续同志参考这篇文章
https://blog.csdn.net/sD7O95O/article/details/136892307

from freeim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.