Setting up new website in IIS7

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?
Who is Participating?
Andres PeralesConnect With a Mentor Commented:
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.
forstersAuthor Commented:
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.
Andres PeralesConnect With a Mentor Commented:
You mentioned host headers, do you have that name in DNS or at least in your host file?
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

forstersAuthor Commented:
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.

Utkarsh KulkarniSr. Sw EngCommented:
You need to access the website as http://<machinName>/Test/Default.aspx
forstersAuthor Commented:
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....

Utkarsh KulkarniSr. Sw EngCommented:
What OS you are using ?
Can you post screen-shot of IIS where you configured the site ?
forstersAuthor Commented:
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.
Andres PeralesCommented:
Since this site is running some scripts, based on the 500 error.  Right click the site and convert to application.
forstersAuthor Commented:
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?

forstersAuthor Commented:
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 you can ignore those authentication msgs.

Hope this helps others setting up with IIs7 for the first time.
forstersAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.