在重新安装Visual Studio 2017后,我试图运行.NET核心Web项目,当我试图在Chrome上运行它时,我得到这个错误:

无法启动程序,当前操作不合法 状态


当前回答

在VS2017中切换浏览器。或者以管理员身份打开命令提示符,运行tskill chrome大约10次,以确保应用完全死亡。然后再试一次。有时它会卡在另一个进程上,甚至需要重新启动。

其他回答

在我的情况下,其他答案都不管用。在重新调试应用程序之前,我必须重新启动windows。

如果你不能用任何其他方式解决这个问题,那么试试这个(它对我很有效!):

将下面的代码保存到您的web配置文件中,然后重命名value="yourwebformname.aspx"

<system.webServer>
    <defaultDocument>
       <files>
          <add value="insertion.aspx" />
       </files>
    </defaultDocument>
    <directoryBrowse enabled="false" />
</system.webServer>

其他的尝试:

<system.webServer>
    <directoryBrowse enabled="true" />
</system.webServer>

3个选项

关闭“Tools > Options > Debugging > General”中的JavaScript调试功能 杀死所有chrome任务 切换到另一个浏览器进行调试

启用JavaScript调试的解决方案

在Chrome浏览器中,进入:设置>高级>系统 并禁用“当谷歌Chrome浏览器关闭时继续运行后台应用程序”。 重要!上面的选项必须为正确的Chrome用户配置文件设置! Visual Studio有自己的Chrome用户配置文件,当你使用“正常”Chrome浏览器时设置的首选项不会对从VS启动的Chrome浏览器产生任何影响(启用JS调试)。

Run your project from VS with "Enable JavaScript debugging..." enabled. The Chrome browser should open and you'll get the error in VS. Go back to the same instance of Chrome that VS started and disable "Continue running background apps when Google Chrome is closed" as explained above. If you don't have "Enable JavaScript debugging..." enabled/checked, the Chrome instance would use your Default User Profile and the error would persist. Stop and rerun your project, Chrome should load the project as expected without any errors and with JS debugging enabled.

当你停止调试时,你必须关闭由VS启动的Chrome实例,否则错误将在下次运行项目时返回。如果有其他Chrome实例,你可以让它们打开。

要确保Chrome使用正确的用户配置文件,请在url栏中输入Chrome://version/,然后查看配置文件路径的值。在Windows上,正确的值应该是这样的: “C: \ \用户【用户名】微软\ AppData \当地\ \ VisualStudio \ 15。* * \ \ WebTools \ ChromeUserData_默认”

如果Chrome使用浏览器默认设置,或者如果你用一个帐户登录Chrome,它将看起来像这样: “C:\Users\[UserName]\AppData\Local\谷歌\Chrome\User Data\[ProfileName] OR Default”

奖金。如果你在调试时使用Chrome扩展,这些必须在VS配置文件激活时安装。

对我来说,问题是在调试Chrome窗口上登录我的谷歌帐户。在我注册之前,这对我来说工作得很好。一旦我退出了那个Chrome实例,并选择通过复选框删除我的所有设置,调试器又正常工作了。

我的非调试Chrome实例仍然登录到谷歌和不受影响。主要的问题是我可爱的插件从调试版本中消失了,但至少我可以再次逐步检查客户端代码。