Unable to publish website from Visual studio 2010

30,348

Solution 1

I had this problem and racked my brain trying to resolve it so I wouldn't have to copy the publish files to a remote server manually. I spent a great deal of time actively trying to get this to work.

Here's how I solved the problem: I went to File>Open in Visual Studio 2010 Express and navigated to the remote server (\\255.255.255.255\folder1\folder2\folder3 and so on). Right away I was challenged for a User Name an Password. I entered the credentials for the REMOTE server, checked the box to 'Remember my credentials'. I immediately tried to publish and voilá - it worked like a charm.

I hope this saves a lot of people a lot of time.

Solution 2

I had this issue - certain members of our team were able to publish directly from VS2010, whereas for some reason I was always getting permission denied errors, even though we were all able to connect to the server we were trying to deploy to. I fixed it in the following way:

Go to "Server Explorer".

Right click "Servers" and go to "Add server..."

Type in the name of the server you are trying to connect to, and then click on "Connect using a different user name..." - put the credentials for logging into the server in here.

Click OK and wait for it to add the server.

Now try and publish to that server and it should be ok...

Not sure why I needed to do this and others were able to deploy without adding the server in this way... remains unexplained.

According to the comments below:

  • You may need to restart Visual Studio in order for this to take effect.
  • This should also work for newer versions of Visual Studio

Solution 3

Faced the same problem today. In my situation I had to close VS2010 and open it NOT as an admin and it worked without any problems.

Solution 4

Are you using web deploy (right click and choose Publish)?

Have you tried copying the ProjectName.Publish.xml file from the one machine where you can publish to the other two machines? The login credentials for publishing are saved in this file.

Solution 5

This got me for a long time...Go to Project - Properties and select the Package/Publish Web tab. Under the header "Web Deployment Package Settings", there's a ellipsis button that you can use to map to the location you want to publish. You will be asked for your credentials during that process.

Share:
30,348

Related videos on Youtube

Jason Evans
Author by

Jason Evans

Software developer currently working for Confused.com in Wales, UK. My core skills are .NET C# ASP.NET MVC JavaScript Reputation tracker My Notes http://blogs.microsoft.co.il/blogs/sasha/archive/2009/07/31/garbage-collection-thread-suspension-delay-250ms-multiples.aspx

Updated on January 05, 2020

Comments

  • Jason Evans
    Jason Evans over 4 years

    We have a an ASP NET MVC website solution which only one out of three devs on the team is able to publish to the live server. When I, and another colleague, attempt to publish the site from VS 2010, the output window will display an error:

    Unable to create the Web site '\blah'. The path '\blah' does not exist or you do not have access. The specified path is invalid.

    This points to a logon issue which my account, but the developer who can publish the site is a member of all the same user groups as me. As a long-shot, we gave Everyone full access to the folder, but this did not resolve the problem.

    Can anyone suggest a more detailed way to try and figure out why we cannot publish the site? There must be a permission set somewhere that is allowing my colleague to publish the site from Visual Studio.

    Cheers. Jas.

  • Jason Evans
    Jason Evans about 13 years
    Yup, we're using the Publish option from right-click menu. I will look into the XML file you mentioned.
  • Jason Evans
    Jason Evans over 12 years
    Cheers for that. When the problem comes up again, I will give it a try.
  • Jason Evans
    Jason Evans over 11 years
    Ahhh, OK. Cheers for that. If I encounter this situation again, then I will try what you suggest. I haven had to publish from VS2010 in a long time, but you never know when it will come up again.
  • Vimes
    Vimes almost 10 years
    This seems like the best, most official solution and worked for me. Thanks!
  • Slawek
    Slawek over 9 years
    This also works if you encounter problems publishing website to file system using non-default credentials after installing update 4 for VS 2013 (2013.4)
  • CkH
    CkH almost 9 years
    Thank you! Thank you! Thank you!
  • Ben L.
    Ben L. over 8 years
    I know your answer here was from a few years back, but it really helped me today, Thanks!
  • Joe
    Joe over 8 years
    @JasonEvans this solution works the same all the way up to VS2015. I just solved the same exact problem in 2015 with this answer.
  • docmanhattan
    docmanhattan over 8 years
    This solution worked for me as well, I had to hack VS to always open as administrator in Windows 10 because I was running into issues when it wasn't. I don't publish often so I'll keep it how it is but it's going to be annoying re-discovering this issue every time I publish (depending on how good my memory is that day...).
  • Bas
    Bas about 8 years
    If only I could upvote this more than once. I would've had NO idea that this would be the problem. How can an elevated instance NOT have access to a folder that my account has access to?
  • greg
    greg almost 8 years
    hours upon hours i have spent my friend. I know this site doesnt like thankyou, but thank you.
  • Rolan
    Rolan over 7 years
    This still works for VS 2015. Kind of a shame that VS still requires a hack like this... Thanks for saving a good chunk of my day.
  • Shaun Roach
    Shaun Roach over 6 years
    Had the same problem in Visual Studio 2015. This sorted it.
  • Sotiris Zegiannis
    Sotiris Zegiannis over 6 years
    This is exactly what i was looking for.Great tip!
  • David Tansey
    David Tansey over 4 years
    Still applies with VS2019...needed this step to be able to push a ClickOnce app to a VM share.
  • d.i.joe
    d.i.joe over 2 years
    This saves my day!
  • Pleebo
    Pleebo about 2 years
    Still needed for VS 2022... Maybe one day this won't be required. @Alet still saving days 10 years later! Thank you!