jump to navigation

Setting up a web application locally with WXP_SP2, IIS 5.1, ASP.NET 2.0 & SQL Server 2005 Express April 4, 2006

Posted by Christian López Espínola in CSharp, Programming.
trackback

Submitted by Rafael Vargas:

I decided to write this short how to in English because the information around the web is not enough to set up the right enviroment to debug our application in our localhost.

So, let’s start!!

I’ve been building a little Web Application in ASP.NET 2.0 which uses a local database file in the App_Data directory. It works fine in the ASP.NET server… but when I tried to use it in the IIS 5.1 it doesn’t. Now, we will take the following steps in order to make it work.

First thing I did was Publishing Web Site, Go to Build menu and choose Publish Web Site instead of Build Web Site. Okay… We will publish it in a folder we’ve created previously. If it founds an old version of our site, it prompts you so as to delete all old files. Choose Ok if so.

Once you have your nice website published, you will find that App_Code folder has disappeared. Don’t worry, classes have been compiled so there’s no need of the sources. (You will find a special file in the bin folder with the assemblies).

After that, you must right-click the root folder of our web application a choose Web Sharing tab from the Propieties window. Select Share this folder and then click Add. A new window appears. In the Alias field, type the name of the Virtual Name of the application. If you write Yadayada, your application will be found at: http://localhost/yadayada. In Access Permissions, you have to let it Read and Write (of course, otherwise you couldn’t update your database), in the Application Permissions one, choose Execute (because Scripts are ASP, not ASP.NET (this is a common mistake)). Click Ok and close the window.

Later, open the IIS Management Console (It’s found in Control Panel > Administrative Tools > Internet Information Services. Extends the Default Web Site node: you should see an item with the alias you chose before (yadayada). Right-click it and choose Properties. Then, go to the Directory Security tab and find the Edit button in the Annonymous Access and Authentication Control frame. Check the Annonymous Access and click Browse, in the new window, write “ASPNET” and click Ok. In this way, any user can use our web application and localhost\ASPNET user account. Now, apply the new configuration.

Finally, we must give the ASPNET user account permission to write in the folder of the web application. Right-click the root folder of our web application a choose Security tab from the Propieties window. If this tab doesn’t appear, you will have to do some changes in your windows configuration. Don’t panic, it’s so easy. In a windows explorer window go to Tools menu, open Folder Options, choose View tab, Uncheck the last option in the Advanced Settings: Use simple file sharing. Apply the new configuration and next time you choose the properties windows from the explorer, you will see a Security Tab.

Okay, you’re got it. You’ll see the Advance button in the bottom of the page. Click it and a new window appears. Just click Add in the new window. And write down ASPNET and click okay. It’s the same kind of window you see before. It adds the local machine aspnet account. Now, you have to choose what permissions this account will have: click Full Control if you’re sure that any of your applications on that folder cannot damage the system (of course man! what are you doing then?). Apply this configuration and try out your web application. You can see there’s no trouble now ^^

I hope this little tutorial help.

Goodbye.

If you’ve got any comment, suggerences or questions, feel free to write down a comment.

Comments»

1. rusdie - March 5, 2007

this help me a little, but i can’t find ASPNET user in my computer, i already install framework 2.0 redistributed packages, IIS 5.1, winXP SP2 and Visual Web Designer. And i always got messages “Server Appliation Unavailable”. What should i do…?? :(

2. ozan - March 19, 2007

i have the same problem with rusdie. i get ’server application unavailable’ message. what should we do?

3. Jeevan Desarda - October 3, 2007

Great work!!! Thanks a lot….

4. any - February 7, 2008

awseome, thanks dude. By the by, some of you may get that Matebase error when you try to run the code? If you do it might be because you installed IIS after the .NET Framework.

The fix is easy. Go to Start/Run > type “CMD”

Use the command CD to go to your .NET Framwork directory, mine is:
C:\Windows\Microsoft.Net\Framework\v2.0.50727

From there run the command > aspnet_regiis – i

This will basically to a repair on your Framework installation and hook it up properly to IIS.

5. malay thakershi - March 18, 2008

aspnet_regiis – i
fixed my issue
thank you

6. Setting up a web application locally with WXP_SP2, IIS 5.1, ASP.NET 2.0 and SQL Server 2005 Express « Vargas & Software Development - July 15, 2008

[...] Server 2005 Express 15 07 2008 I founded this mini howto I wrote a few years back lost at Penyaskito# blog. I think it is time to publish at his [...]

7. Tom - December 26, 2008

that’s amazing thanks rafael
and thanks any for aspnet_regiis -i tip
it solve my problem.

8. How Mun » Rush Hour coming - February 6, 2009

[...] Regarding how to run a web Service in IIS 5.1, here’s the tutorial: http://penyaskito.wordpress.com/2006/04/04/setting-up-a-web-application-locally-with-wxp_sp2-iis-51-... [...]

9. nicolas.wai - April 21, 2009

thanks a lot for your message…..
it’s really precious..
i can solve my problem because of your message.

10. Timothy - August 20, 2009

thanks for this great insight. but when i followed all the tutorial, i’m still getting the same error: Login failed for user Timotech01/ASPNET. Cannot open ASPNETDB database
which is my database that controls the login.
Please is there anyother thing i can do. Thanks so much