Sunday, September 14, 2008

ASP.NET Deployment Issues

Thought of sharing my Experience till date with you

I am making use of Windows XP, Delphi 7, IIS and VS 2005.

I am currently in to a project where in I need to access data from a Delphi 7 ActiveX COM Object Library and display it in ASP.NET web page; I have been doing a lot of R&D on this via Google search. As of Today I have been able to access data and display it on to a ASP.NET GridView (I will cover this subject in later blogs), we are still evolving the project

In today’s blog I will talk about deployment issue that I faced while deploying my new ASP.NET project on to IIS server which may be common issue

Issue #1:- Can’t browse web page from IIS server
My project was successfully running from VS 2005 IDE but it did not work from IIS, i.e. when I typed in http://localhost/(my virtual directory name) in IE it went in to a infinite loop and the progress bar kept crawling and eventually returned with no page found error message.

When I saw the Application log in the event viewer (Start --> Control Panel --> Administrative Tools --> Event Viewer) it stated that the asp net work process (aspnet_wp.exe ) had stopped working.

Cause: - Within my project before loading the index page (i.e. the page that I was retrieving) some where I was trying to create a COM object and this was taking a hell lot of time.

The reason for this is that the IIS uses the ‘ASPNET’ user (which is created in windows XP by Microsoft .NET framework) to create this COM object and since it has very little permissions it is unable to create the COM object resulting in the above issue.

Solution: - The solution in my case was to add a new user who had permission and could create the COM object (In my case it was my machine user name), add this user in machine.config file (Note I am using ASP.NET 2.0) ‘C: \WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\Machine.config’

In the config file add this tag under "System.Web"
“processModel autoConfig="true" userName="Machine User” password="Corresponding Password"”

I learnt that web.config within the project overrides the machine.config file values, you may wanna make use of this.

Issue #2:- Can access using localhost but does not work with IP address
After applying the above solution I could access my page from my machine using http://localhost/( Virtual Directory name) but not using my IP address http://ipaddress/(%20Virtural Directory name), but I could not access it from other machines within my LAN network.

Cause: - windows firewall settings were on (If this is off you may never face this issue)

Solution: - Go to Start --> Control Panel --> Windows Firewall --> Go to Exceptions tab --> add port --> Name it as “IIS” and port as “80”

This solution should solve the issue.