无法在IntelliJ中调试Web服务代码

C4C*_*Exe 8 java debugging windows-services intellij-idea

我有一个已安装的窗口服务.我在Intelli J.中打开了应用程序的源代码.

我将配置IntelliJ如下所示 在此输入图像描述

我检查了它正在使用的服务和端口的PID.

在Intelli J中运行远程配置时会出现以下错误

4:09:18 PM Error running Remote: Unable to open debugger port : java.net.ConnectException "Connection refused: connect"
Run Code Online (Sandbox Code Playgroud)

有人可以说明如何在IntelliJ中调试窗口服务.这是一份工作计划申请.

installService.cmd如下

set HOME_DIR=%~dp0
set SERVICE="Service_Name"
SET JAVA_OPTIONS=-Xms256m -Xmx256m
@echo Service name is Service_Name
"pathname\Service_Name.exe" -install %SERVICE% %JVM% %JAVA_OPTIONS% -Djava.class.path="pathname\Service_Name.jar" -Dorg.quartz.properties="pathname/Service_NameScheduler.properties" -start com.org.st.Service_Name -stop com.org.st.Service_Name -out "D:/core_log\Service_Name_service_out.log" -err "D:/core_log\Service_Name_service_error.log" -current "pathname\apps"
set JVM="C:/Program Files/Java/jdk1.6.0_29/jre/bin/server/jvm.dll"
Run Code Online (Sandbox Code Playgroud)

Vic*_*Vic 2

请将 IntelliJ 调试配置中的命令行参数附加到该行SET JAVA_OPTIONS,它将类似于

SET JAVA_OPTIONS=-Xms256m -Xmx256m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=51211
Run Code Online (Sandbox Code Playgroud)

并重新安装服务。

  • 我已经完成了。但是在调试模式下运行远程配置时,我收到“java.net.ConnectException“连接被拒绝:连接”错误。 (3认同)