views:

417

answers:

5

I finished my very first C# project in VS 2008 and it is working well now. But now I need to publish this project onto my new website. This project is a web application that interacts with my SQL Server 2008 Adventureworks database on this same computer(XP Professional OS). I am running IIS 6.0 Manager, but I am a newbie to both IIS 6.0 and VS 2008.

I began by right-clicking the application in VS and selecting "Publish", but I've just selected File System, cause choosing Local IIS forces me to enter Username and password.

The problem is that I can't open this website from IIS without it prompting me for username and password. I have modified machine.config file several times in the processModel section, by setting username="D610-M\ASPNET", password="AutoGenerate". But this makes me enter built-in password when I try to view it. And I don't know what built-in ASPNET password is. When I cancel this password popup, it returns:

HTTP 401.1 "You are not authorized to view this page."

And I've reset the ASPNET password several times. First I tried setting it to a password I knew, then I ran the aspnet_regiis command to reinitialize it. I also tried substituting other usernames and passwords, but none of them have worked. I even tried entering "SYSTEM" for username and AutoGenerate password, but even this prompts me to enter password. I have added the ASPNET user Read/Write/List permissions to all relevant folders. And I tried to create a new website pointing to http://localhost/[AppName], but this forces me to enter password. So no getting around that password.

I have modified Properties for Default Website in IIS: Home Directory pointing to my application in VS 2008 folder and Application Protection = Low. On Directory Security tab, I set username to D610-M\IUSR_D610-M and I checked "Enable anonymous access." I unchecked the Allow IIS to control password.

And I have read alot of MS URL's and other websites to see if I could answer these problems myself, but none of their helps worked either. This should be simple. I'm just trying to add my web application to my website. I know that my website works cause I installed a default website with basic HTML and it works.

What else can I try in order to add this web app to my website?

A: 

Usually, I recommend the initial build to be to a location in C:\ (example being C:\MyFirstApplication). You also need to make sure the "Network Service" has permissions to that folder. Placing the application in the projects (or whatever) folder in your personal documents list is asking for permissions and access issues. Try that and see if it works!

Tejs
Tejs,I tried this but then what do I enter for username and password after clicking Browse?
salvationishere
A: 

You need to set root level folder permissions on your web site. Navigate to the folder that holds your web site, right click, permissions, security tab. Make sure that you have asp.net, anonymous user, Internet Guest Account (computer\iuser_{something}) and network service in the allowed roles.

As an aside I suggest that you pre-compile your site before posting it to your web server. This is a security precaution and a performance booster. Getting into this habit will be a good thing for you in the long run. It keeps people from tweaking the code on the server. There is a good utility here to make this easier: http://www.west-wind.com/tools/aspnetcompiler.asp

Andrew Siemer
Andrew, I downloaded the ASP.NET 2.0 compiler. What is the difference between pre-compiling and building? I added all of the user accounts from your first paragraph and made sure they had Read, Write, List permissions. However, it is still prompting me to enter username/password. What do I enter here?
salvationishere
When you say read, write, and list that tells me that you set permissions from IIS. You need to go into windows explorer and make sure that the appropriate accounts are listed (per recommendation above) at that level. Build simply builds everything. You can still change code behinds and they will recompile on the fly. When you publish...IIS has to build when the page is executed. Pre-compile takes all the code behind and puts it into an assembly (so no server side editing) and they are compiled and ready to go when they are requested (hence performance inhancement).
Andrew Siemer
A: 

I believe this is pretty much the same as the question posed by him earlier here

Abhijeet Patel
Yes, it is. But I have consolidated the most important comments down into this one question here.
salvationishere
Did you ever change the IWAM _xxx or IUSR_xxx accounts or their password manually, if you did that may cause some trouble. Check out this link:http://www.issociate.de/board/post/175508/Recreate_IWAM_and_IUSR_accounts,_how?.htmlto re-create the the IIS user accounts and run aspnet_regiis -i again to ensure ASPNET is registered properly. Also check out the properties of the Default web site and ensure that all other authentication modes except Anonymous are disabled. Let us know if this changes anything.
Abhijeet Patel
I checked out that link. No, I never changed either of these passwords. I will check properties. Right now I am trying out creating a New Website and copying all of the required files over to it from my Web App. I'll let you guys know how this goes. I probably won't finish this though until tomorrow.
salvationishere
+1  A: 

I am not sure if this is it, but.... I have seen this error myself and it is usually caused by not having the ASP.NET version set to 2.0 in your Website properties under the ASP.NET tab. This setting is often defaulted to ASP.NET 1.1 which would cause this error to occur. Note, that even though you are using Visual Studio 2008 the ASP.NET Version is still needs to be 2.0 in IIS. I would double check this setting.

Bryan Sebastian
Bryan, I checked the Properties/Build tab and it is set to ASP.NET 3.5. I don't see an ASP.NET tab however. Is this what you mean?
salvationishere
No, you are looking in Visual Studio. I am talking about your properties on your website in IIS. When you go into IIS and right click on your website there should be a properties menu item. Select that and a dialog box will be displayed for your website's properties. There should be an "ASP.NET" tab which indicates which version of ASP.NET to use for that website. There should only be 2 choices... 1.1 and 2.0. My hunch is that this is set to 1.1 in your case. Switch it to 2.0. For some crazy reason ASP.NET 3.x is treated as ASP.NET 2.0 under IIS.
Bryan Sebastian
+1  A: 

One important limitation to remember is that you are only allowed one website on IIS6 on XP.

If you have edited your machine.config you have introduced too many new variables into the equation to properly troubleshoot the problem (not that editing machine.config in itself is harmful, but it's an indication that there's a bit of shotgun approach to the problem).

You need to start out by wiping your slate clean and making sure that you have an otherwise working system. Browsing an HTML page does not prove much as running HTML and running ASP.NET are like apples and bicycles.

The best that I know of for doing this is uninstalling and reinstalling IIS and whatever .NET framework you are on. If you are on 3.5 you should do this for both two and three point five. If you can you need to put machine.config and every version of web.config (except the one in your web app itself) back to their defaults. There is nothing there you should need to edit run an ordinary ASP.NET app.

Once you think you have a tabla rasa and can browse an html page, then change its extension to .aspx and see if you can still browse it.

My last suggestion for today is:

As a poster above said set your ACLs on the folder where your website is (typically c:\inetpub\wwwroot) so that the group "Everyone" has "Full Access". Don't leave it this way, even on your own machine, but it takes file permissions out of the equation. If you are still having problems let me know, but basically you need to start from a "known good" state if you ever hope to get this problem resolved.

zenWeasel
Is IIS 6 available on XP. My understanding was it's only available on Win Server 2003
Abhijeet Patel
Yes, IIS6 Manager is available on XP. Zen, I uninstalled IIS. But I need to borrow a W XP CD before I can reinstall it. I'll let you know, just hope this fixes it!
salvationishere