Exception when Deploying to SharePoint 2010 from Visual Studio 2010
I've done MOSS 2007 development for some time, and am just starting to get my feet wet with ShareP开发者_如何转开发oint 2010. I created a SharePoint project, added a Visual Web Part, and typed "Hello, World!" into the web part's user control.
Everything works fine the first time I deploy the project (by selecting Deploy from the project's context menu in the Solution Explorer). It deploys the project, activates the feature, and the web part is immediately available for use.
However...
The second time I deploy the project, I get an error in the Error List stating:
Error occurred in deployment step 'Recycle IIS Application Pool': Invalid namespace
Now, if I go to SharePoint and manually delete the web part, deactivate the feature, and retract the solution, I can deploy from Visual Studio again; the error seems to only occur if the project has been deployed at least once.
I think I'm missing something obvious here. Any recommendations?
I found the answer!
But not on the Web, so I'll post it here as I did in a related posting on SharePoint.SE.
Apparently, VS 2010 uses WMI to control IIS during a redeploy. Without the features enabled, I got the error described above.
The solution was to: open the Turn Windows on or off menu in the Control Panel (under Programs), and enable WMI compatibility. The path to the feature is:
Internet Information Services -> Web Management Tools -> IIS 6 Management Compatibility -> IIS 6 WMI Compatibility
Edit: For reference sake, this article has screenshots of which features should be activated on Windows 7 to support SharePoint.
精彩评论