Visual Studio Hosting Process and “The operation c

2019-01-09 18:31发布

问题:

When trying to execute from within Visual Studio 2008 your application and you get the (uninformative) message "The operation could not be completed".

The solution to this is to turn off the "Visual Studio Hosting Process".

The problem with turning off this "hosting process" is that all the "run and rewrite" functionality is no longer available. OK, so this isn't a big deal, but I'm always getting this message no matter what machine I use (and it might be nice once in a while to use the rewrite and execute functionality).

Am I doing something wrong? How come this "feature" within VS seems to complain so readily? Do other people have success with enabling the hosting process and making use of it?

回答1:

The problem with turning off this "hosting process" is that all the "run and rewrite" functionality is no longer available.

The Visual Studio Hosting Process is not needed to allow Edit and Continue. It is used for "Design time expression Evalutation" in the case where the project is a dll rather than an EXE. It is also used to provide debugging for partial trust scenarios. See the documentation for everything it does.

It is highly unlikely it does anything you need, so don't feel bad turning it off.



回答2:

Is your project output folder set to a network share?

If so, try changing it to a local folder and see what happens. It appears that VS is not always able to terminate the process if the host exe is running from a share.

The other possibility is that the project is open and running in debug mode on another instance of Visual Studio - although I suspect you will allready have ensured this is not the case.



回答3:

I honestly have never seen this message and I work with Visual Studio for at least 8 hours a day. Is this reproducible on other machines? If so is there anything weird or abnormal in your code that could cause this to crash?



回答4:

I use 4 different machines and have got this situation on all of them. I understand what is causing the problem - it is that the VS hosting process isn't terminating after the first debug session ends, which means that the next time that you try to compile the exe the hosting process is locking the exe and preventing compilation. Another solution therefore is to use Task Manager to kill the VS hosting process and compile and debug as normal but thats even more of a hassle!

I can't think that its anything in my code that would be causing this - its probably a VS issue itself isn't it?



回答5:

Here's the anwser: disable "Enable he Visual Studio hosting process" in he debug tab of your projects properties.

I found it here: http://social.msdn.microsoft.com/Forums/en-US/vbide/thread/40d2d241-a0c0-4137-9da9-e40611972c0e/



回答6:

There are several causes and workarounds regarding to this problem and you might try the following ones that are useful most of the time:

Delete the "Your_Solution_FileName.suo" file and restart Visual Studio.

or

Right click on the project and select Unload Project and then click Reload Project by right clicking on the project again might also fix it.

Hope this helps...



回答7:

Probably your web hosting already turn of the network function, you can open a ticket to contact with your web host to confirm, or anything you did would be useless.

Some visual studio hosting can be found at here.

Good luck,

Mark