skip to Main Content

I am newer to ASP.Net. I am normally a desktop application developer creating content for internal company consumption.

I have been fighting Visual Studio for a couple of days now to publish a basic webapplication. I am using VS Comm 2019, C#.Net and targeting .Net 4.7.2 (This is Windows only!)

I am really close to getting this thing to work and I think I need SO to get me across the finish line.

  • I do not have a DefaultWebSite in IIS. I deleted it using advise from SO.

I was able to publish with this settings

server: localhost
sitename: WebApp01
destination url: webapp01.net
user name/pwd: both are correct
publish settings

I created a website in IIS with these settings:
IIS website

Publishing in Visual Studio with web publish seems to work well.
After I publish the site comes up like this
enter image description here

I know that is an invalid url. What can I do to get a proper local site up and running so I may continue my work? Thanks in advance! Please ask for more details. As a newer ASP.Net I am sure I forgot something and don’t mean to poke any bears out there.

3

Answers


  1. I doubt it will work locally without updating hosts file.

    1. Go to C:WindowsSystem32driversetc

    2. Open ‘hosts’ file as Administrator

    3. Add the following line to the bottom of the file:

      127.0.0.1 webapp01.net

    4. Give it a couple of minutes and try reloading your browser tab once again.

    Login or Signup to reply.
  2. Ok, it not clear if when you publish, that you have the web site setup correctly (you have to install some publishing software into that web server to work).

    So, what I would do is simply publish your web site to a local folder.

    Say like this:

    enter image description here

    So, we use file publish – that way we eliminate the 100 or more issues of having setup the web server to accept the publishing system (there is a lot of gears and leavers so to speak to set that up. This way, we publish local – no ftp, no logon, no passwords to connect etc. And NO NEED for even if the web server is up and running).

    Ok so in above, "web" folder, we will have what amounts to the required working web site. At that point, you can FTP, copy to a jump drive or whatever. We simple now need to COPY this folder to the server.

    So, on the server, we have this folder:

    enter image description here

    So, just copy/move/get the web folder from your local computer to the above default web site.

    once you done that, then you can config, or even start up that web site from IIS.

    eg this:

    enter image description here

    In fact, even BEFORE you start up the site, why not choose this option:

    enter image description here

    That option (explore) will simply open up the folder on the server WHERE that site resides. Maybe your config different. Maybe the location is on a different drive (drive d:). Don’t really know, don’t care. The simple matter is you want to 100%, and in fact 200% be sure you open up the correct folder. Since that folder is where you copy your local published web folder to (actually the files in side that folder – you copy to the folder that the web site is running).

    Next up:
    As noted, it not clear due to fire wall issues, network settings, are you on a domain (and the 100+ more possible issues to be aware of), then as I noted, I strong, but STRONG suggest you get this up and working by IP address. The only exception to this rule is if you already say have a URL and a hosting mapping setup (say for a production web server that say outside users will be using). But so far, sounds like this is internal for testing.

    Ok, now you need the IP of that server this site is running on. One the other hand, IIS is quite cool, in that you can use + assign a DIFFERENT IP address for the web site – and you can do this without say adding a extra network card. Don’t know if the web site is assigned a IP address, or is fixed????

    anyway, assuming you copied the files from your local "file" web publish, then next is to setup the bindings, or at least check them.

    eg this:

    so, FIRST click on your site (highlight) – left side, and then on right side select bindings:

    enter image description here

    And now you can enter your URL, but as noted, doubt you have names resolution working, but as noted, at least test/try IP address.

    eg:

    enter image description here

    So, set the site to a IP address You can often leave this blank. But at least check this.

    And while most servers have their browser locked down (can’t run JavaScript etc.), you can at least click on this to launch the site – see if it at least launches to main page:

    enter image description here

    So, above should only take a minute or two to test and try.

    As noted, if you using a file publish, then you should stop the web site, or at the very least re-start the web site from IIS if you use file publishing, but at least a file copy is quite a fail safe approach to taking your first baby steps until over time you say or attempt to use publishing directly to the site from Visual Studio.

    I in fact, still use the above simple file publish – even for FTP, since then I can use any FTP software, and all we are doing is copy some files from a folder local to the folder on the server that IIS is pointing to for that given site.

    Login or Signup to reply.
  3. I am going to try to answer my question as best as possible.

    The secret sauce is definitely shared between the ASP.Net C# solution and a ‘website’ in IIS. I will post pictures for my answers and a picture of publishing.

    Ensure proper IIS Windows features for ASP.NET C# dynamic pages

    IIS FeaturesMy Application is named ‘WebFoo’

    Visual Studio Web Deploy Publish Settings

    Additional Publish Settings

    Andy added as an application pool

    Andy applications

    Andy website in IIS

    Andy Application

    Andy Application published - The crowd goes wild!!!!!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search