H??ritage de configuration dans une application asp.net – Configuration inheritance in an asp.net application

Written by Yves

December 17, 2004

En se référant à la documentation Microsoft à propos de l’héritage de configuration, une illustration prête à confusion, et le texte l’accompagnant ne lève pas le doute :



Pour moi, il s’agit de répertoire. Il se trouve que si ce sont des répertoires normaux, les différents fichiers web.config situés dans SubDir1 et SubDir2 ne seront pas pris en compte (!!). Pour qu’ils le soient, il faut que ces répertoires soient configurés comme des applications dans IIS. Premier problème résolu.


Dans Visual Studio cependant, il faut créer une autre application web qui sera hébergée dans ces sous-répertoires. Je me lance alors dans cette opération, crée ma web form, génère la dll et lance l’application. L’application affiche alors un message d’erreur de type “Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately”. Plusieurs forums parlent de ce problème avec diverses solutions. La solution en fait peut être résumée en une phrase : ne jamais créer un virtual directory et une application web avec Visual Studio. On connait déjà le problème de Visual Studio quand il s’agit de sortir un projet web de Visual Source Safe et là, il s’agit d’un autre problème qui s’ajoute.


Pour ajouter une application web dans un sous-répertoire d’une autre application, il faut d’abord créer le répertoire dans Windows Explorer, ensuite créer le virtual directory et seulement ensuite créer le projet d’application web dans Visual Studio en le faisant pointer vers le bon virtual directory. Second problème résolu, mais, malheureument, très mal documenté.


 


Reading the Microsoft documentation about configuration inheritance, there is a picture that can be confusing. The documentation itself is not even more clear :



Seeing the pictures, that are folders and sub-folders. But, if you put some web.config files in SubDir1 and SubDir2, all setting in these configuration files will not work (!!). To override settings, you must configure the sub-folders as applications in IIS. First problem solved.


So, in Dans Visual Studio, you can create a new web application which will be hosted in one of these sub-folders. I do that then I created a new web form, I built the dll and try to run the application. The application showed me the following message :”Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately”. Several forums try to solve this issue with one or more solutions. We can say them in one sentence : never create a virtual directory and a web application with Visual Studio. We already know the problem of getting a project from Visual SourceSafe and here it is a new problem.


To add a new web application in a sub-folder of an existing web application, you firstly have to create the sub-folder in the Windows Explorer, then create the virtual directory in IIS and lastly create the web application in Visual Studio in that virtual directory. Second problem solved, but, unfortunately, very badly documented.

You May Also Like…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *