trouble publishing app on IIS, always landing on welcome page - asp.net

I'm trying to publish a C# app on my windows PC but cant succeed using IIS,
I've been publishing my app with with visual studio no problem,
When i add a new website on IIS and only specify the name and physical path the app is indeed working on localhost,
But when i add my IP to the host name, i can connect, but always land on IIS Welcome Page...
I've tried to move my published folder inside the default website folder but it does'nt seem to work either.
default page for reference

Related

How can I get Visual Studio to automatically attach debugger to web Site not Application?

I have a web application required to run as a Web Site (root application). This is due to it being a multi tenant application that uses the urls sub domain prefix to know which client is accessing it. I create the site in IIS 10 setting the physical path to my Visual Studio 2017 .NET 4.5 MVC application and the site works fine.
I open the web project properties and under Servers choose Local IIS setting and set Project Url to the site I just created in IIS. Visual Studio then forces me to create a Virtual Directory for the Project Url, to save it, which then creates a Web Application under the default web site. You can't set and save the Project Url without being forced to create the virtual directory.
Now when I start debugging Visual Studio attaches to the Web Application not my web site so my breakpoints never get hit. If I manually attach to the w3wp process where the web site is running I can debug. I had this all working fine prior to recently switching to Git causing me to reconfigure things and I can't recall what I did to make it work.
How can I set the Project Url on web properties page without being forced to create a virtual directory? Or how do I make VS automatically attach to the Web Site and not Web App I was forced to create?
This blog might help: How to Debug Your ASP.NET Projects Running Under IIS
If your project is a website and not a web app, then here are the steps to configure it to use IIS when debugging. This assumes you already have IIS set up and hosting your project.
In the solution explorer.
Right-click on your project node and navigate to "Property Pages".
Navigate to "Start Options" item in the left pane.
In the "Server" section make sure "Use custom server" is checked.
In the "Base URL:" field put in the address you have mapped to your project. (Usually the address you put in your hosts file)
I finally discovered that setting the Servers 'Project Url' in the web projects properties page to 'http://localhost/' does not force you to use the 'Create Virtual Directory' to save the changes. You can't even change the default port here without being forced to create a virtual directory.

How to configure IIS 7 for localhost website?

I am new in Asp.Net
I have enabled features of IIS 7 on my windows system and able to see IIS manager.
I created an application but build/run application through visual studio it goes to browser and run the application with different port number. When i stop build/run application through visual studio and again i refresh browser application could not run.
I want to run application without visual studio. How to do this.
It gives this : http://localhost:9864/
To configure IIS with a new website follow these instructions:
Open IIS manager, right click Sites (At the right menu) and click Add Website
Give the site a Site Name, The physical path on your machine, and a Host Name
There are some conventions as for what website physical path to choose you can read about it in this SO question
In Windows Explorer go to C:\Windows\System32\drivers\etc and Edit the hosts file
Add this line at the end of the file:
127.0.0.1 your-chosen-host-name-from-iis-ie-localhost.testsite.com
And save the file
Thats about it. You can open your browser and browse the Host Name you chosen for your website or in IIS right click your site and click Manage Website - Browse
Important note
If you wish to use the same address as your VS uses (http://localhost:9864/) then on step 2 leave the Host Name textbox blank and instead change the Port textbox to your desired port (9864). In this case you can also ignore step 3.
As a site note:
If you installed IIS on your machine after the VS installation you might get some conflicts. You might be able by this stage to browse to static content as html but not .NET resources like aspx files. If by browsing to .NET files you get a message saying The page you are requesting cannot be served because of the extension configuration you can solve it with this SO question

Published website ASP.NET with IIS

I have just completed my website and I started working with IIS it works fine when I put all my file without published. I copy the whole website to wwwroot inside my folder as I said It works fine but when I tried to work without code behind page it didn't work I published website from VS. and I copy my published file to the same folder but it doesn't work.
I received this error:
Eval is not declared. It may be inaccessible due to its protection level.
I don't want to put my code behind page. How can I run my published pages?
First, when you publish your web project, their are no code behind pages.
Do this, set a directory and publish your site in it.
Now cmd-> intemgr->
site-> -> add web site->
give site name and select an application pool, then set the physical path to the directory where your application is published, if necessary change the port to something like 50 because 80 is a standard port for http. Hit ok. Your site is ready.
Please check in application pool that your application pool is set to .Net framework version V4.0 (i mean the version compatible to your app ).
just click to browser the site, please do check the uri you can see the port number also

After switching Visual Studio to use local IIS server, image and style files not found

I changed my website properties in Visual Studio 2010 to "Use local IIS Web Server" instead of the Visual Studio Development Server, and clicked "Create Virtual Directory".
Now my images and styles are not found when I view the website in localhost. The paths in the website are relative. The 404 message says the physical path is "C:\inetpub\wwwroot", which is not the application root. If I copy my image and style folders into "C:\inetpub\wwwroot" then the images appear.
Have I missed some configuration setting to ensure static files come from the application rather than the wwwroot?
You'll need to check the application in IIS. The default website defaults to pointing to c:\inetpub\wwwroot by default. If your site is a virtual directory rather than an application in IIS (e.g. http://localhost/yoursite as opposed to http://localhost:6000) and you are referencing your static files using URLs like this: /images/file.jpg, then IIS will be looking in the wwwroot folder for those files.
I would manually create a new website in IIS, pointing at your application's root folder, on a port of your choosing, and then go back to your settings page in Visual Studio and update the port number.
Make sure that your site is a Site in its own right and not a directory hanging off the Default Website. That's more akin to how it will be set up in your live environment anyway.
you probably have to publish your site. the VS Dev server runs your code int eh directory that the project is in. to run your code now you probably have to publish to the new locations
Old question, but I ran into this.
I double checked my site bindings and the issue that eventually led to this being solved for me was to make a change in my 'host' file.
System32->drivers->etc.
I added my site to this file and it worked like a charm afterwards.

Getting You do not currently have a default Web page established for your users. when running VS2008 solution

I have website in VS2008. Created the Virtual directory in IIS 5.1. When I try and run the site to debug from Visual Studio I keep on getting:
Your Web service is now running.
You do not currently have a default Web page established for your users. Any users attempting to connect to your Web site from another machine are currently receiving an Under Construction page. Your Web server lists the following files as possible default Web pages: default.htm,default.asp,index.htm,iisstart.asp. Currently, only iisstart.asp exists.
To add documents to your default Web site, save files in c:\inetpub\wwwroot.
I have no idea why this is happening.
Can anyone help me?
If I understand correctly, it may be as simple as this:
In Solution Explorer, right-click on the page you want to be the default page and click "Set as Start Page".

Resources