Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Attention: open in a new window. PDFPrintE-mail

If you get this lovely message:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

when you're trying to deploy a Web Part to SharePoint using Visual Studio, go to the start menu and choose run/services.msc and disable the indexing service. It worked for me.