Go Premium for a chance to win a PS4. Enter to Win


Setting up new website in IIS7

Posted on 2010-09-21
Medium Priority
Last Modified: 2012-05-10
Hi all,

I need some help setting up  a new site on IIS7.

Using Visual Studio 2010 I've created a new ASP.NET web site in .NET Framework 4 C#,
I pointed the site to a local folder called "Test"
I made no changes to the default files.

I created a Folder "Test" on a drive e$ and then used the IIS Manager to "Add New Web Site"
I called the site "Test"
mapped it to my folder "Test" on e$
and under bindings I left the port unchanged,
kept the All Unassigned for the IP
and set the host header to testsite

I returned to VS2010 and used the build website command to publish the default files to my "Test" folder on e$ on the webserver.

Returned to IIS7 to check the folder and noted the files had been published successfully.

If I use f5 from VS I see the default.aspx page without problem but I assume from the url that I am viewing it on the VS built in host:

Because I am new to VS (just to complicate things) I also opened the site in Dreamweaver and used f12 to publish the "Default.aspx" page from there, at which point I get the standard 404 error:
The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /Default.aspx

So the url in this case is http://testsite/Default.aspx 

I can't figure out what I'm missing / doing wrong, I just want to be able to view the live page hosted on the web server.

can anyone advise?
Question by:forsters
  • 7
  • 3
  • 2
LVL 17

Accepted Solution

Andres Perales earned 2000 total points
ID: 33733497
Typically URL's will be the http://machinename/ for default website
Try that you should see the IIS 7 Logo.
Also check the Default Document list to see if default.aspx is there, if not you will want to add it to the list!  So you do not have to type out http://machinename/default.aspx every time you try to hit your website.

Author Comment

ID: 33736144
Hi peralesa,

Thanks for your comments.

Yes the default website is as you suggest http://servername/ and I can see the IIS7 logo both from browsing on the server itself and by browsing on my pc.

I checked the Default Document list as suggested, default.aspx is there...I've moved it to the top of the list to apparently improve performance - no change

The other thing I notice is using the feature in IIS manager to browse the site (by right-clicking, manage site, browse) I get a site http:testsite/ but its not mine!

If I change my host header name the page I get changes, but these are not my pages.

If I switch my Test site to Content view and right-click browse on the Default.aspx file rather than the site root I go back to the HTTP 404 error.

This is on the server nothing is found by browsing from my PC.

If I browse http://testsite/ from my pc I get a 403 Forbidden error
If I browse http://testsite/default.aspx I get the 404 error  

Any further help greatly appreciated.
LVL 17

Assisted Solution

by:Andres Perales
Andres Perales earned 2000 total points
ID: 33736999
You mentioned host headers, do you have that name in DNS or at least in your host file?
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal


Author Comment

ID: 33742554
yes my host file has the name testsite in it hmm but you saying that has just made me think...

new server = new IP address (I had automatically just put in the old IP)

Have amended IP to resolve but now get "Error 500 Internal server Error" if I browse from my PC.

Obviously no change on the server if I browse the site.

I don't recall ever adding a site name to DNS - presume though if we host all our sites on one/two servers its the servers that are added to the DNS in which case I need to speak to my colleague.

Maybe a step closer to resolving, thanks for your help if you can offer anymore guidance greatly appreciate the help.


Expert Comment

by:Utkarsh Kulkarni
ID: 33743294
You need to access the website as http://<machinName>/Test/Default.aspx

Author Comment

ID: 33743849
hi astroutkarsh

We tried this already using both the machine name and its ip address in the url both bring up 404 errors if I just use the site root, if I use the full address including default.aspx then we get 500 error.

If I put http://machinename/ that brings up the default IIS7 site without problem.

This suggests to me the problem is not the connection to the server its to do with the set up of my testsite on IIS7, or we've missed something when installing IIS7 on the server....


Expert Comment

by:Utkarsh Kulkarni
ID: 33744043
What OS you are using ?
Can you post screen-shot of IIS where you configured the site ?

Author Comment

ID: 33744268
OS = Windows 2007.

Screen shot attached, I set the site up in IIS Manager; the Default app Pool is set to .NET 4.0 which is the framework that was used in VS to create the site.
LVL 17

Expert Comment

by:Andres Perales
ID: 33745091
Since this site is running some scripts, based on the 500 error.  Right click the site and convert to application.

Author Comment

ID: 33745730
Hi thanks,

we gave that a go and I noticed as I set the application up that when I tested the connection I got an authentication error, I now note I get the same error if I rebuild the site and test the settings so could this be the problem?

(see attached for screen shot)

Any ideas what the cause is?


Author Comment

ID: 33753183
Thanks to all who helped on this, we have now located the problem:

In IIS Manager when viewing the features the .NET Compilation was not viewable, the error read Unrecognised expression 'folderLevelBuildProviders' in web.config.

The web.config in question lives on the server %windir%\Microsoft.NET\Framework64\v4.0.30319\config\web.config.

The fix was to run aspnet_regiis.exe /iru from the command prompt window making sure to use the relevant Framework and version (in our case running .NET 4.0 on a 64bit machine)...
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe /iru
did the trick; the .NET Compilation tab subsequently opened without error.

The authentication error mentioned above seems now to be a red-herring:

I did follow one suggestion to add the servername$ to permissions and share the file but have since discovered that the site can now be browsed regardless and that as ultimately suggested here http://forums.iis.net/t/1148262.aspx you can ignore those authentication msgs.

Hope this helps others setting up with IIs7 for the first time.

Author Closing Comment

ID: 33768110
The question kinda evolved as we tried different things but definite thanks to peralesa for helping me to identify the root of the problem, my final comment indicates what this was and the fix we used.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I came across an interesting issue that had me pulling my hair out.  I was troubleshooting a new internal web site which uses integrated security instead of anonymous.  When browsing the site from my laptop, I was able to access it with no iss…
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question