none
Can't publish to localhost (IIS 7.5)

    Question

  • Hi

    This is a follow up with my previous post here which was resolved but then I stumbled with another challenge.

    I have installed and setup IIS 7.5, SQL Express, Visual Studio - 2012 Server Configuration With Local SQL Express, VS 2012 trial version in a laptop (Windows 7)

    I created a test app (app1) with 1 table and was able to publish the app using desktop and web.  The database was created in SQL, database login and application admin.  All was working well using Forms authentication.

    Then I created a 2nd app (app2), this time using an external data source connecting to the database that was created by the first app (app1).  I successfully published the 2nd app (app2) by desktop but when I publish to IIS, the Service URL in the Publish Output page will not accept the http://hostname (where hostname is the laptop name).  Even using http://localhost, it does not accept it and the (exclamation sign) warning turns ON.  Even if I force to publish, it prompts

    "Please provide values for all required fields before publishing".

    I decided to leave app2 for the time being and tried to re-publish app1.  I get the same result, the Service URL doesn't like the local hostname. 

    There were no changes or update during the whole exercise but I am baffled why suddenly it will not accept the hostname.

    I have checked everything, Web Deploy agent is running WMSVC is running.

    Has anyone experienced the same problem?

    Any help would be greatly appreciated. Thanks.



    • Edited by var-it Monday, April 29, 2013 4:19 AM
    Monday, April 29, 2013 4:11 AM

Answers

  • Hi Brian

    Thanks for your reply.  While I was waiting for any replies.  I copied app1 to my other laptop (original laptop has VS 2012) and created a package instead of publishing remotely to the spare laptop (spare laptop is where app1 was created which is the laptop in question in this post) as it won't work (will investigate some other time).  I imported the package successfully in the spare laptop.  So, I am happy with it at this stage.

    To answer your questions:

    1. the tooltip says "Lightswitch must be run with administrator privileges to deploy to localhost".  I am a member of "Administrator" group and I was able to publish app1 before the problem occurred.  So, it should not be displaying this error.  Anyway, when I got your reply, I tried to run VS 2012 as administrator and successfully published the app remnotely to the localhost.

    but before that, I made a lot of changes to the spare laptop to troubleshoot the problem.  So, I am unsure if the following had made any difference at all.

    - uninstalled IIS & reinstalled IIS

    - repaired Web Deploy 3.0

    - installed Web Deploy 2.0 (as per suggestion by other threads) but did not work so I unsintalled it again.

    - registered asp net 4 (using aspnet_regiis -ir) as suddenly it was not showing in the application pool. perhaps it got unregistered when I uninstalled IIS

    2. it was doing the same even if I just type 'localhost' or the name of pc without http:

    3. Yes, I can type in a different remote host but not the localhost

    4. I did not try the package.

    By the way, I tried again publishing it remotely and this time it worked.  I unticked/unchecked the 'IIS Server has the LightSwitch Deployment Prerequisites installed'.

    Anyway, this post has been solved and I have another challenge that I will be posting separately.  This time using external data source which was my original objective.

    Thanks for your time.


    • Marked as answer by var-it Wednesday, May 01, 2013 2:40 AM
    Wednesday, May 01, 2013 2:40 AM

All replies

  • A couple thoughts (perhaps try these in this order):

    1) what does the tooltip for the yellow warning icon say?

    2) what happens if you type in "localhost" or "hostname" without the http://  (also try using https://localhost)

    3) can you type in a remote host and publish (even if you type in something you know doesn't work, can you get past the "required" error?

    4) can you publish to a package and import the package via IISMGR?

    LMK how it goes...

    Tuesday, April 30, 2013 10:31 PM
    Moderator
  • Hi Brian

    Thanks for your reply.  While I was waiting for any replies.  I copied app1 to my other laptop (original laptop has VS 2012) and created a package instead of publishing remotely to the spare laptop (spare laptop is where app1 was created which is the laptop in question in this post) as it won't work (will investigate some other time).  I imported the package successfully in the spare laptop.  So, I am happy with it at this stage.

    To answer your questions:

    1. the tooltip says "Lightswitch must be run with administrator privileges to deploy to localhost".  I am a member of "Administrator" group and I was able to publish app1 before the problem occurred.  So, it should not be displaying this error.  Anyway, when I got your reply, I tried to run VS 2012 as administrator and successfully published the app remnotely to the localhost.

    but before that, I made a lot of changes to the spare laptop to troubleshoot the problem.  So, I am unsure if the following had made any difference at all.

    - uninstalled IIS & reinstalled IIS

    - repaired Web Deploy 3.0

    - installed Web Deploy 2.0 (as per suggestion by other threads) but did not work so I unsintalled it again.

    - registered asp net 4 (using aspnet_regiis -ir) as suddenly it was not showing in the application pool. perhaps it got unregistered when I uninstalled IIS

    2. it was doing the same even if I just type 'localhost' or the name of pc without http:

    3. Yes, I can type in a different remote host but not the localhost

    4. I did not try the package.

    By the way, I tried again publishing it remotely and this time it worked.  I unticked/unchecked the 'IIS Server has the LightSwitch Deployment Prerequisites installed'.

    Anyway, this post has been solved and I have another challenge that I will be posting separately.  This time using external data source which was my original objective.

    Thanks for your time.


    • Marked as answer by var-it Wednesday, May 01, 2013 2:40 AM
    Wednesday, May 01, 2013 2:40 AM
  • Thanks for the details - I think you may have found a bug here... can you confirm this for me?

    You are an admin on the box (i.e. the localhost that was having trouble)

    UAC is enabled, so by default, VS is run as a normal user

    Then when publishing to localhost, the publish wizard complains about you not being an admin (probably due to UAC)

    If, you launch VS as admin on the same machine, you can publish to localhost.

    Do I have the details correct?

    Wednesday, May 01, 2013 4:35 PM
    Moderator
  • Hi Brian

    Yes, that is correct.  I am an administrator in the localhost and the weird thing is that I was able to publish the first app (app1) without any problems.  Only after I created the 2nd app and tried to publish is when the problem started.  Again, there were no changes or updates during the whole exercise and the creation of the projects were only probably 15 mins apart.

    I am trying to figure out what could have happened.  The same thing happened to my original laptop and that is why I tried to install a fresh install of everything in this spare laptop (laptop being questioned in this post).  I can't publish to local IIS even my user account is an administrator.  I have to run VS2012 as administrator to be able to publish to localhost IIS.

    Since, I have had the same issue with the spare laptop and my original laptop.  I am not sure if the problem occurs after the first app is published which I need to prove if I have another spare laptop but unfortunately I have none left.  Maybe, you could try it.  Here are the steps I've done.

    1. Freshly installed and setup all softwares (VS2012 Professional (trial version), IIS 7.5, SQL Express 2008, Lightswtich for VS 2012 - Server Configuration with SQL using Web installer 4.5)

    2. created app using (Lightswitch in VB, .Net 4.5)

    3. created 1 table with 3 columns

    4. Published app as desktop. After desktop was published, checked SQL server and the database was created with all aspnet table for user, roles, permission and the 1 table I created.

    Using Forms authentication in both desktop and web.

    Application Type: Desktop

    Application Server configuration: selected Local

    Publish Output: selected 'Publish directly to the database now'.  Left the path to default location.


    Database connections.  I specified the user connection and the catalog (the catalog and user have not been created yet in the SQL database) using the Connection Properties when you click the 3 dots "..." (ellipses) . Checked 'Publish database schema' and specified the administrator connection using the Connection Properties.   I chose the Windows authentication. NOTE: As the database has not been created, the 'Test Connection' would fail.

    I clicked the 'Created Database Login' button to create the user I specified in the 'user connection'.  Checked the SQL Security logins and the database user was created.

    Authentication: selected Yes, create an Application Administrator'. Filled in the details for the application administrator

    Prerequisites: set to 'No, only install the prerequisites. Install location for the prerequisites set to 'Download from the Internet'

    Specify Certficate: left blank

    Published successful.

    5. Installed the desktop app. Tested the desktop and was able to create new users and records. checked the SQL database and all changes were saved.

    6. Then, published the app as web.

    Application Type: Web

    Application Server configuration: selected IIS

    checked the 'IIS Server has the LightSwitch Deployment Prerequisite installed'

    Publish Output: selected 'Remotely publish to a server now'.  Typed in the http://hostname. Left the default site.  the username and password were disabled (I posted question about this in here and Dave said it is suppose to be disabled if VS 2012 is in the same machine as the IIS)

    Security settings set to 'Off'

    Database connections.  I specified the user connection and the catalog using the Connection Properties when you click the 3 dots "..." (ellipses) . This time the 'Test Connection' works as the database and user have been created when app was published as desktop.

    Unchecked 'Publish database schema'.

    Authentication: selected 'No, an application Administrator already exists'

    Specify Certificate: set to blank.

    7. I tested the app by browsing to localhost/app.  Was able to see the records that were created using the desktop and created new user and records.

    Success..

    8. Then I created a 2nd app (app2) and did the same steps but when I tried to publish to IIS.  The Service URL would not accept the localhost name anymore and the warning sign appears.  This is where it fails.

    The warning disappears if I run VS2012 as administrator.  Could this be a bug?  

    By the way, Update 2 for VS 2012 is not installed yet in the laptop but it is installed in my original laptop which is doing the same thing.  This means the update does not make any difference but I could try installing Update 2 in this laptop to prove it.


    • Edited by var-it Wednesday, May 01, 2013 9:26 PM
    Wednesday, May 01, 2013 8:56 PM
  • Thanks var-it - I think the simple scenario I asked about above is the only requirement to hit the problem.  Publishing to localhost requires admin perms and running as a normal user != running as admin.  We'll take a look but I think WebDeploy is not going to cooperate in this case.  I was able to repro with a brand new project.

    Thanks for helping us track this down...

    Brian

    Wednesday, May 01, 2013 9:51 PM
    Moderator
  • Hi Brian

    I have a similar problem using IIS 7.5 on my development machine, because I should test something https-related which is not possible with the development web server. Running my Visual Studio 2012 as my user which is in the local administrator group I get the error. Running it as the .\Administrator account the project loads. But when connecting to the SQL Server the inner exception says: "login with user 'myDomain\VITALSTATISTIX$' failed" where VITALSTATISTIX is my machine name.

    Do you have a solution for that problem?

    Tuesday, December 10, 2013 11:04 AM
  • If a bug not fixed in VS2012 SP xxx  that happens only to IIS 7.5 Express i think it's a bug in Webdeploy. Best way is to use the package to the remote server, that works!.

    Perhaps solved VS2013 not tested.


    Eric



    • Edited by bea2701 Tuesday, December 10, 2013 11:56 AM
    Tuesday, December 10, 2013 11:54 AM
  • I solved my problem by following these instructions:

    www[dot]hanselman[dot]com[slash]blog[slash]WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress[dot]aspx

    I'm sorry but I couldn't post links.

    Tuesday, December 10, 2013 3:58 PM