Installing ASP.NET project on IIS

With virtual directory

Preparation and procedure for this problem using an example.

Subscribe to our newsletter

Problem

Sometimes it happens that an application in the browser always throws an exception as soon as a file has been loaded. This may be due to different user credentials of the web server and the file server and the correct setting in the IIS. In the following, the correct procedure is explained using the example of an ASP.NET application without a database.

Preparation

  1. First, the project should be compiled in Visual Studio under "create" and "publish project".
  2. A new profile must then be created or an existing one used. For connection (for the publishing method), "file system" and the storage location should be selected.
  3. The next step is to set the configuration to release and publish the project.
  4. Finally, the compiled file should be placed in the wwwroot folder of the desired web server and the IIS should be started. After this step, the folder should now be in the directory of the IIS.

IIS configuration

If it is not clear beforehand, then it should be checked whether asp.NET has been activated under the features. This can be found under "Internet Information Services -->WWW Services --> .NET Extensibility 4.6 and ASP.NET 4.6.". In the next step, the IIS Manager should be started. The project should now be found under Default Web Site.
At this point comes the most important part of the setting in IIS, so that the user can access data on another file server. The application user must always correspond to the user of the file server, otherwise no access is possible. The user can be set under the application pools.

.NET CLR version v4.0 should be present by default, as well as that the managed pipeline mode is set to integrated. Click on "Ok" and the pool is activated and started.

In this step, right-click on the newly created pool and select "Advanced Settings" and "Identity". The user should be set to "manual".

  • In the application under Default Web Site, "converted to application" and the correct application pool should be selected.
  • A virtual directory is then created that allows access to a file server. A new virtual directory should be created in the application (by right-clicking) and an alias entered.
  • In this step, the same user must be entered for "connect as..." as in the previous step for the application pool. Now confirm and the application can be started.

With this procedure, there should be no problems if the file and web servers are separate from each other, with different users and no longer throw an exception.

Subscribe to our newsletter

Subscribe to our quarterly newsletter and stay up to date.

* Mandatory field