Correct path to publish to IIS - asp.net

I've managed to deploy my website to test through Publish Web in VS2012 using the connection criteria below. This launches fine and works as expected but I need to keep clicking the publish button each time to get the page to launch.
However, rather than keep publishing each time, I'm trying to run it directly from IIS by opening IIS (inetmgr) select the site folder and browse. However, it tries to launch localhost/MyWebsite/ and not the full path localhost/MyWebsite/home.aspx so I get a blank page.
The project also has the home.aspx set as start page. Can anyone point out why I can't get this to run from IIS where it's already published? It's probably something obvious but I can't see it.

ON IIS, go to DEFAULT and add HOME.aspx, on the top of the list.

In IIS, you specifying that you want to browse that site which is "localhost/MyWebSite/" you could go into "Content View" and select "Home.aspx" and then select browse if you want the full path to that file for another solution.

Insted of setting default document from IIS set it from web.config . so that you no need to set default document every time .
Web.config
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="home.html" />
</files>
</defaultDocument>

Related

IIS doesn't show my web page

I had some problems to show my webPage using IIS 8.0.
Now I get no erros when I open my page through IIS but now it only appears:
Local host - /
Date Time Folder's Name
Date Time Folder's Name
Date Time Folder's Name
What Should I do to show my WebPage?
I already checked the ASP.NET option on Active or Desactive Windows Featuresof control panel.
If you want to use a custom page name for your default page like "mypages.aspx" as in your case, you can configure to do so in your web.config
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="~/mypages.aspx"/>
</files>
</defaultDocument>
</system.webServer>
You can do the same in IIS going to DefaultDocument section under your deployed site settings in IIS. Check this and this so question as your are using IIS8 for more info.
Did you check to make sure you have a default webpage? E.g. index.html, index.asp, default.html or default.asp? The names are based on the settings of the site of course.
Make a basic html page:
<html>
<body>
Hello world.
</body>
</html>
Then put it in the directory IIS is looking for, for the website. You'll want to make sure you setup your DNS to reflect the domain you are trying to host, and then change your local network settings to use your computer's IP before any other DNS. This will allow you to see the website.

Unable to load default aspx web page

I have published my website in a directory called samp and i am currently trying to host it on IIS.
However i have numerous aspx pages. For example, members.aspx, default.aspx, authenticate.aspx, etc.
But i am not sure how do i make default.aspx to load when the user connects to localhost at port 80.
I am new at this, please help.
You can enable it through the Web.config file in your ASP.net website.
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="Default.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
Note: This is especially important if you're debugging with IISExpress (i.e. inside Visual Studio 2015), where you don't heve the option to configure your default files directly (as in IIS - see freefaller's answer).
In IIS7 click on the website in question (under the "Sites" area of the left-hand tree), then find "Default Document" in the IIS group of icons. Double click the icon to go into the section, then click "Add..." in the Actions panel and then add "default.aspx" in the dialog.
You can then set the order of precedence by clicking on the new entry and moving it to the top of the list using the "Move Up" option in the Actions panel.
This will allocate the default document to the website in question - if you want it adding to ALL websites on IIS7, then do the same thing to the top level icon (the one under "Start Page")

How do I set the default page of my application in IIS7?

I deployed my web application to IIS7 and everything works just fine. However, instead of typing the url of my true starting page, I want it to automatically go to www.xxxxxx.com/views/root/default.aspx.
How do I do this?
Just go to web.config file and add following
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="Path of your Page" />
</files>
</defaultDocument>
</system.webServer>
On IIS Manager select your page in the Sites tree.
Double click on configuration editor.
Select system.webServer/defaultDocument in the drop-down.
Change the "default.aspx" to the name of your document.
Karan has posted the answer but that didn't work for me. So, I am posting what worked for me. If that didn't work then user can try this
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="myFile.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
On IIS Manager--> Http view--> double click on Default and write the name of your desired startup page, Thats it
For those who are newbie like me, Open IIS, expand your server name, choose sites, click on your website. On new install, it is Default web site. Click it. On the right side you have Default document option. Double click it. You will see default.htm, default.asp, index.htm etc.. to the extreme right click add. Enter the full name of your file(including extension) that you want to set it as default. click ok. Open cmd prompt as admin and reset iis. Remove all files from c:\inetpub\wwwroot folder like iisstart.html, index.html etc.
Note: This will automatically create web.config file in your c:\inetpub\wwwroot folder. I didnt have any web.config files in my inetpub or wwwroot folders. This automatically created one for me.
Next time when you enter http(s)://servername, it opens the default page you set.
If you want to do something like,User enter url "www.xxxxxx.com/views/root/" & default page is displayed then I guess you have to set the default/home/welcome page attribute in IIS. But if user just enters "www.xxxxxx.com" and you still want to forward to your url, then you have write a line of code in the default page to forward to your desired url. This default page should be in root directory of your application, so www.xxxxx.com will load www.xxxx.com/index.html which will redirect the user to your desired url
I was trying do the same of making a particular file my default page, instead of directory structure.
So in IIS server I had to go to Default Document, add the page that I want to make as default and at the same time, go to the Web.config file and update the defaultDocument header with "enabled=true". This worked for me. Hopefully it helps.

When publishing a web site, my default document name keeps getting removed from IIS

I have an ASP.NET web site project, which I'm publishing to IIS on my Win2k8 R2 server. It has a default page called login.aspx. I set that up on the published web site.
Trouble is, every time I publish a new version of the web site, the login.aspx entry gets erased from the "Default Document" settings of the web site in IIS. This is very annoying. How can I publish my web site from Visual Studio without wiping out the default page every time?
Try putting a defaultDocument in your site's web.config:
<system.webServer>
<!-- your other stuff -->
<defaultDocument enabled="true">
<files>
<clear/>
<add value="login.aspx"/>
</files>
</defaultDocument>
</system.webServer>
You are probably using "sub site", and the default document list of the root website is blank.
Try adding default document (even dummy) to the root website and see if it helps.
(Taken from here: http://forums.iis.net/t/1169880.aspx)
when the login.aspx is added to subsite. it's type 'local'. it gives this error.
you should add this page to the servere itself.
click the server and then choose the feature view--> iis--- default document then right click to add your "login.aspx" page.
now you should see this in default document of all your sub sites and it will not be erased in publish or server restart.
this is my personal exceperience
Omar kamel

Why isn't my IHttpHandler being called?

I'm trying to get a custom handler to work for a specific URL (or set of URLs) in ASP.NET 3.5.
The handler doesn't actually do anything significant yet - it just logs the request. I can post the code if anyone things it's relevant, but I really don't think it's being called at all. (In particular, for normal exceptions I get a custom error page and logging... here I'm just getting the vanilla IIS 404.)
Here's the relevant bit of the web.config file:
<system.web>
<httpHandlers>
<add verb="GET,POST" path="*.robot" validate="false"
type="CSharpInDepth.Wave.RobotHandler, CSharpInDepth"/>
</httpHandlers>
</system.web>
(Obviously there's other stuff in that section too, but I don't think it's relevant.)
Locally, running under the dev server, it works fine. On my real box, I always get a 404. Everything under the web site directory itself is the same (replicated via svn). That includes the bin directory containing CSharpInDepth.dll, which I've verified contains CSharpInDepth.Wave.RobotHandler.
I try to fetch http://csharpindepth.com/foo.robot and just get a 404.
I've tried with and without the assembly name, specific URLs or wildcarded ones... nothing's working.
I'm sure I've just missed some simple flag somewhere in the IIS configuration, but I'm blowed if I can find it...
EDIT: It's IIS version 6. Attempting to add *.robot to the ISAPI filter now...
Well if the hosting box is IIS7 in integrated pipeline you need to add it into the other bit of the config:
<system.webmodules>
....
<modules>
<add name="RobotHandler" type="CSharpInDepth.Wave.RobotHandler, CSharpInDepth"/>
</modules>
....
</system.webmodules>
If it's IIS6 then you'll need to map *.robots to the ASP.NET ISAPI DLL.
(For the non-Skeets you do this as follows)
Open up IIS admin.
Right click on
the Web site you want to configure
and select Properties form the
context menu. This will display the
Web Site Properties dialog.
Select
the Home Directory tab and click the
Configuration button. This will
display the Application
Configuration dialog box.
Click
Add.
Select the aspnet_isapi.dll
from the .NET framework directory,
the extension you want mapped and
either All Verbs, or just the ones
you want to map.
Click ok.
Jon,
You'll have to configure the IIS script mappings to pass *.robot to aspnet_isapi.dll.

Resources