먼저 vs2017을 사용하여 바닐라 asp.net 코어 2.0 웹 사이트를 만듭니다. 그 후, 나는이 선 startup.cs를 업데이트하여 노드 시작을 추가 : 나는 일부 데이터를 반환하고 내가 로컬로 실행하면 작동보기를 만들ASP.NET 코어 2.0에서 노드 시작시 오류 발생
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddNodeServices(options => {
options.LaunchWithDebugging = true;
options.DebuggingPort = 9229;
});
}
. 여기에 그 코드는 다음과 같이
public async Task<IActionResult> NodeTest([FromServices] INodeServices nodeServices)
{
ViewData["ResultFromNode"] =
await nodeServices.InvokeAsync<string>("NodeSrc/myNodeModule.js");
return View(viewName: "NodeTest");
}
내 myNodeModule.js은 다음과 같습니다
module.exports = function (callback) {
var message = 'Hello from Node js script at ' +
new Date().toString() + ' process.versions ' +
process.version;
callback(/* error */ null, message);
};
나는 그것이 작동 vs2017 로컬로이 프로그램을 실행할 때. VSTS를 사용하고 배포 할 때 ASPNETCORE_ENVIRONMENT의 프로세스 변수를 Development에 추가 한 후에도 페이지를 탐색하려고 할 때 오류가 발생합니다. 아래 오류 i.
내 2 개의 질문은 다음과 같습니다. 1. 더 나은 오류를보고하려면 어떻게해야합니까? 2. 노드를 디버그 모드와 프로덕션 모드로 모두 실행하려면 어떻게해야합니까?
오류 :
당신은 JS 파일 속성의 출력 디렉토리에 복사에 새로운 경우 복사를 지정해야Error.
An error occurred while processing your request.
Request ID: 0HL87NKEP2GL6:00000002
Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.
Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
ASPNETCORE_ENVIRONMENT 변수는 런타임에 사용되며 빌드에 영향을주지 않습니다. 새 프로젝트로이 문제를 재현 해 주실 수 있습니까? OneDrive에서 세부 빌드 및 로그를 공유하십시오. –
azure portal => 웹 응용 프로그램 => 응용 프로그램 설정 => 응용 프로그램 설정의 개발 값으로 ASPNETCORE_ENVIRONMENT를 추가 한 다음 웹 응용 프로그램을 탐색하고 세부 오류를 확인하십시오. –
문제를 해결합니까? –