Thursday, December 20, 2007

Publishing .NET to an IIS server woes..

Been having trouble at work getting an ASP.NET project to publish on a local dedicated server but ive finally found the simplest method. here goes:

1. With ASP.NET 2.0 there are no precompiled assemblies and everything is runtime compiled so all one needs to do is copy the project folder across to the \intepub\wwwroot\ folder on the server.

2. Make sure >NET 2.0 has been installed and is linked to IIS. You will know its working when under the IIS manager>Web Service Extensions it shows ASP.NET v2.0 is allowed. If there is no green check mark then select and allow it.

Photobucket

3. Now comes the part where everyone screws up. The .aspx file is now accessible but will always return an error when accessed from the local server or elsewhere on the network. The reason is the virtual directory containing our project files on the server has to be configured as an application in the IIS in order for the ASP code to be compiled at runtime. You will see something like this :

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:

Line 49: ...
Line 50: -->
Line 51:
Line 52:


To get around this simply right-click on the website folder under "Default Web Site" in the IIS manager and under the Directory tab under Application settings select create and this registers the application with the IIS.
Photobucket Photobucket

The website should be up and running now. Hope this helps.

No comments: