Visual Studio 2017 error: Unable to start program, An operation is not legal in the current state

前端 未结 20 2175
醉话见心
醉话见心 2020-12-12 08:43

After fresh installation of Visual Studio 2017 I tried to run .NET Core Web project and when trying to run it on Chrome I am getting this error:

Unabl

相关标签:
20条回答
  • 2020-12-12 09:27

    Solution with JavaScript debugging enabled

    From the Chrome browser, go to: Settings>Advanced>System and disable "Continue running background apps when Google Chrome is closed".

    IMPORTANT! The option above must be set for the correct Chrome User Profile!
    Visual Studio has its own Chrome User Profile, preferences you set when using your "normal" Chrome browser wont have any affect on the Chrome browser launched from VS (with JS debugging enabled).

    1. Run your project from VS with "Enable JavaScript debugging..." enabled. The Chrome browser should open and you'll get the error in VS.
    2. 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.
    3. Stop and rerun your project, Chrome should load the project as expected without any errors and with JS debugging enabled.

    Whenever you stop debugging, you must close the Chrome instance initiated by VS or the error will return the next time you run the project. If there are other Chrome instances, you can leave these open.

    To make sure Chrome is using the correct User Profile, go to chrome://version/ by typing it in the url bar, then look at the value for Profile Path. On Windows, the correct value should look something like this:
    "C:\Users\[UserName]\AppData\Local\Microsoft\VisualStudio\15.*\WebTools\ChromeUserData_*\Default"

    If Chrome is using the browser default or if you're logged in to Chrome with an account, it will look something like this:
    "C:\Users\[UserName]\AppData\Local\Google\Chrome\User Data\[ProfileName] OR Default"

    Bonus note. If you use Chrome Extensions when debugging, these has to be installed when the VS Profile is active.

    0 讨论(0)
  • 2020-12-12 09:30

    The other answers in my case did not work. I had to restart windows before I could debug the application again.

    0 讨论(0)
提交回复
热议问题