IIS & Visual Studio 2010: Publishing Gotchas using Web Deploy

Posted by OmegaMan at March 25, 2011

Category: IIS, Visual Studio

Tags: , ,

On my current project I am in charge of getting a fresh install of Server 2008 R2 with IIS 7.5 running to support a Silverlight web site and its accompanying  WCF service. Here are the some of the error messages and tips and tricks I did to get Visual Studio 2010 Web Deploy to work.

IIS 7.5 Failure Possibilities

Web deployment task failed.(Remote agent (URL http://… //MSDEPLOYAGENTSERVICE) could not be contacted.  Make sure the remote agent service is installed and started on the target computer.)

Remote agent (URL http://… //MSDEPLOYAGENTSERVICE) could not be contacted.  Make sure the remote agent service is installed and started on the target computer.

An unsupported response was received. The response header ‘MSDeploy.Response’ was ” but ‘v1’ was expected.
The remote server returned an error: (503) Server Unavailable.

These errors can come up and for the most part can be fixed on the Server which is running IIS.

  1. Web Deploy package is not installed on the IIS server in question. To install find the “Web Deploy” or “Web Deploy 2.0” from the top level IIS.Net\Download (for downloading all extensions) or directly on the Web Deploy 2.0 page.  Alternately if the Platform installer addin is installed one can find it through the IIS Server Manager where one can also install it and other goodies. (The platform installer as shown below can be found in the Server list or and individual website list of icons in the management section.)
    WebPlatform
  2. Even if Web Deploy package is installed, the service is not running automatically. Follow these steps to find the correct service and get it running.
    1. Run services.msc from the start bar or command line.
    2. Search for the service named Web Deployment Agent Service. Once found verify it is running and also starts up automatically after a reboot.
      WebDeploymentAgentService
  3. Also your account may not have permissions to publish to the web site in question. In IIS Management Studio, find the website in question and make sure your (or other’s) credentials are found in the IIS Manager Permission list.
    Permissions

Fear and Loathing in Visual Studio During Publish

Here are some of the errors one can get when trying to publish

Web deployment task failed.(Could not complete the request to remote agent URL ‘https://{your server name}:8172/msdeploy.axd?site=Default Web Site’.)

Could not complete the request to remote agent URL ‘https://{your server name}:8172/msdeploy.axd?site=Default Web Site’.
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
The remote certificate is invalid according to the validation procedure.

If you get one of the above, it is suggesting that it cannot find your server. To fix this situation, specify the server name with HTTP:// behind it. For example if (on your intranet) you remote to your server named ValHalla Visual Studio expects you to have this in the server line to look like this:
Service URL

No need to have /MsDeploy.axd!

Wait There is More

If you receive any of these errors:

Invalid Service Url

Web deployment task failed. An error occurred when the request was processed on the remote computer.)

An error occurred when the request was processed on the remote computer.
Site ‘OneSource’ does not exist.

Check the website name. Note IIS is setup with at default web site named “Default Web Site”. If that is the case then literally specify “Default Web Site” in the list. Otherwise find the name of the target website and the application/service which has been setup in IIS and make sure one is publishing to that site/name combination. The following example is publishing the OneSource site to a “Default Web Site” in IIS.

Default

I hope this helps (HTH) to any whomever may come after. Smile

Share

8 Comments

  1. Carl says

    I’ve ran into another publishing issue.
    I have two IIS apps in separate app pools and virtual directories, Tom & Jerry. Tom is built as default.aspx, Jerry as jerry.aspx.
    When I set the default page for Jerry to jerry.aspx, everything works fine. If I later deploy Tom, then Jerry loses jerry.aspx default page setting and I need to manually set this again.

    Reply
    • OmegaMan says

      Carl, I have seen that as well and it is an IIS issue! After doing many IIS changes and or updates as you point out, I finally gave in and simply renamed my default page to default.aspx. grrr.

      Reply
  2. Rich says

    How about this…

    My package creates its own App Pool and I need to create a login on the database server for that App Pool e.g.

    create login [IIS APPPOOL\Rich] from windows with default_database=[Rich]

    But SQL Server complains that the Windows login ‘IIS APPPOOL\Rich’ doesn’t exist yet.

    I would have though Web Deploy should create the site/app pool etc. before executing the DB scripts?!

    Argh.

    Reply
  3. Robert says

    How about if my web site is located at go daddy?
    What will i put in Service URL ?
    I cannot find any info from go daddy site.
    Thanks.

    Reply
    • OmegaMan says

      That all depends on the provider. First the account you have with them has to be an Asp.net type hosting and not an apache hosting. Secondly the provider should provide you with the URL and credentials. I suggest you contact your provider directly with such questions.

      Reply
  4. Fred Robertsz says

    I found it really informative and useful. Thank you for sharing your knowledge about this stuff. Great share.

    Reply
  5. Sunny says

    Excellent article!! 2 Hours of struggle and i stumble on this website and its resolved in 5 mins. Thanks a ton for this article.

    Reply
  6. James N says

    Thank you, this helped me.

    Reply

Leave a comment

(required)
(required) (will not be published)

This site uses Akismet to reduce spam. Learn how your comment data is processed.