我刚刚升级了主硬盘,不得不重新安装所有内容(Windows 10 Pro),并且在尝试运行Visual Studio(16.6.1)时遇到问题。我安装了Web Developer和Node.js工作负载以及Node.js V12.17.0-x64。
我先使用ASP.NET Core Web Application
然后使用Angular App模板创建了一个测试项目。我第一次可以很好地运行项目,但此后将无法启动。我可以使用ng serve
从命令行正常运行项目,但不能从VS开始。命令行的输出也不会显示任何异常。
VS输出窗口中有一些警告和错误
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.TimeoutException: The Angular CLI process did not start listening for requests within the timeout period of 0 seconds. Check the log output for error information.
at Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout[T](Task`1 task, TimeSpan timeoutDelay, String message)
at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task`1 baseUriTask, CancellationToken applicationStoppingToken, Boolean proxy404s)
at Microsoft.AspNetCore.Builder.SpaProxyingExtensions.<>c__DisplayClass2_0.<<UseProxyToSpaDevelopmentServer>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
我检查了事件查看器,它包含与上面相同的错误,但确实注意到了一些新警告:
The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID
{2593F8B9-4EAF-457C-B68A-50F6B8EA6B54}
and APPID
{15C20B67-12E7-4BB6-92BB-7AFF07997402}
to the user <user> SID (S-1-5-21-548233098-1309769412-91800121-1001) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.
我能在网上找到的东西并不罕见,大多数答案表明它可以忽略,但我不记得以前见过这些。除此之外,我找不到其他错误或警告。
在成功成功启动应用程序之后,一些服务被挂起,一些节点服务以及几个命令行服务被挂起。这已经有一段时间了,所以我不确定是否相关。我确实尝试重新启动以确保所有服务都被杀死,但这无济于事。有没有一种方法可以显示节点上的控制台窗口,而不是让它们在后台启动以查看它们是否包含任何消息或错误?
我尝试删除项目的.vs
和bin
的{{1}}文件夹,但这似乎没什么作用。
这不是我遇到的唯一问题,看起来Visual Studio也卡在obj
上。我在网上找到了解决方案,但犹豫不决,认为实际问题可能是其他原因,因为该解决方案设置了注册表值来禁用警告,但确实是另一个常见问题。
另一个问题似乎与安装扩展有关,当我尝试安装任何扩展时,VSIX安装程序似乎需要花费很长时间才能显示,而当它完成时,它似乎似乎已被锁定,但最终会安装。表示将显示VSIX安装程序,并且当我单击“修改”按钮时,没有按钮按下指示,并且安装程序似乎已锁定,但是大约一分钟后它将最终开始运行安装,并且扩展程序似乎可以正常运行
在能够从命令行运行Angular App之前,我必须进入组策略编辑器( gpedit.msc )并设置Downloading IntelliSense index from nuget.org
并启用{{1} }并设置为Local Computer Policy -> Computer Configuration -> Administrative Templates -> Windows Components -> Windows Powershell
我是否需要允许其他组策略或应该进行其他系统设置更改?这可能是IIS Express问题吗?
通过卸载node.js并重新安装,我可以走得更远。我最初是先安装node.js,然后再安装Visual Studio,这似乎可以加快一些工作。 Visual Studio进程似乎存在问题,要花很长时间才能关闭主要VS进程,并显示VSIX安装程序,并且在按“修改”后VSIX仍在做任何指示。
VS主流程是否需要允许其他策略或权限?似乎VS必须等待其他正在运行的进程结束。
经过一些研究,我发现Angular无法启动的问题是由于错误引起的,问题在于.NET没有收到有关here所述应用程序正在运行的消息。通过该answer,使应用正常运行的一种解决方法是更新angular.json并添加Turn on Script Execution
Allow local scripts and remote singed scripts
如果升级Angular(默认模板使用Angular 8),请从"progress": true
中删除以下内容:
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"progress": true,
...
},
我仍然遇到节点服务挂起的问题,每次都必须从任务管理器中手动杀死Visual Studio,因此节点似乎有问题。
在终止main.ts
进程之前,是否还有另一条消息正在等待VS?