err_empty_response何时呼叫KTOR服务器方法
我已经在Localhost 8081端口上启动了KTOR服务器实例 app.conf
ktor {
deployment {
port = 8081
port = ${?PORT}
}
application {
modules = [ server.AdminModuleKt.adminModule ]
}
hikariconfig = "resources/dbconfig.properties"
}
jwt {
secret = "secret"
issuer = "http://0.0.0.0:8081/"
audience = "http://0.0.0.0:8081/admin/audience"
realm = "Access to 'audience'"
}
服务器启动正常,但是当我尝试调用任何方法时,它只响应err_empty_response
方法示例
get(BASE_PATH.plus(PING_PATH)) {
call.response.status(HttpStatusCode.OK)
call.respond("Service available")
}
它可以正常工作,但是有一天它开始发送空响应。 主要课程 fun main(args:array< string>):unit = io.ktor.server.netty.entty.enginemain.main.main(args)
in build> build.gradle.gradle
mainClassName =“ io.ktor.server.netty.enginemain”
I have started ktor server instance on localhost 8081 port
app.conf
ktor {
deployment {
port = 8081
port = ${?PORT}
}
application {
modules = [ server.AdminModuleKt.adminModule ]
}
hikariconfig = "resources/dbconfig.properties"
}
jwt {
secret = "secret"
issuer = "http://0.0.0.0:8081/"
audience = "http://0.0.0.0:8081/admin/audience"
realm = "Access to 'audience'"
}
Server starts normal, but when i tries to call any method it respond only ERR_EMPTY_RESPONSE
Method example
get(BASE_PATH.plus(PING_PATH)) {
call.response.status(HttpStatusCode.OK)
call.respond("Service available")
}
It works fine, but in one moment it start to send empty responses.
Main classfun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
In build.gradle
mainClassName = "io.ktor.server.netty.EngineMain"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是依赖关系冲突。
我有Kotlinx序列化版本2+和其他功能1.6.x版本
这就是为什么
路由
in应用程序
不适合DSL错误@[错误:io.ktor.util.pipeline.contextdsl]
使所有功能依赖关系1.6.x解决了问题
The problem was in dependencies conflicts.
I had kotlinx serialization version 2+ and other features version 1.6.x
That is why
routing
inApplication
didn't work with DSL error@[ERROR : io.ktor.util.pipeline.ContextDsl]
Making all feature dependencies 1.6.x has solved the problem