nopCommerce & DNN - web.config conflicts

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 years ago
Hi guys

I managed to install nopCommerce yesterday and it looks great.  I have it in a sub folder of the root of my site \store. The web.config file is sitting in that folder.

I installed today DotNetNuke in the root of my webspace and this has its own web.config file.

Now of course I can't get both applications running at the same time. I have to rename one of the web.config files to get the other app to work and so on.

Is there a workaround to this or an easy way to merge the web.config files? I take it that parts of the web.config file are conflicting with each other. What would happen if i moved the nop web.config file out of \store?

Just to make things worse nop and DNN use different databases.

Any help most welcome!

Martin
14 years ago
.Net sites use inheritance on the web.config. The one in the sub folder will try to merge and conflict with the one in the root. You need to add code to the root web.config that will block this behaver.

put this around what you do not want to inherit:

<location path="." inheritInChildApplications="false">

</location>
14 years ago
Thank you.. I wil give it a try when i work our what I dont need to inherit!
14 years ago
Hi

I have looke around the web but I am still having the same problem when I have 2 web.config files. This does appear to be a parent\child issue and the <location> tag appears to be the way to resolve it.

I have added this to the <system.web> section (below) but I am still getting run time errors. As nopCommerce has its own web.conig file I even tried putting a <location> tag around everything in the DNN file and it still didnt work.

I have posted the DNN web.config file below. Can anyone tell me which parts of this would conflct with the nopCommerce web.config.

To confirm, If rename this DNN web.config file nopCommerce works, and if I rename the nopCommerce web.config DNN works. The will not work togther.

Martin

I followed this example. Do I need to do this anywhere else?

But what to do when there are many settings in your root web.config file that you don't want to be propagated to your child applications?

Here is the solution:
With the <location> attribute with inheritInChildApplications set to false in your root web.config file you can restrict configuration inheritance.
So, by wrapping a section of your web.config file in <location> attribute you can instruct ASP.NET not to inherit those settings to child applications/folders and their web.config files.

In fact  you can wrap the whole <system.web> section in one <location> attribute and disable configuration inheritance so none of the parent settings from <system.web> will be inherited to the child applications you create in subfolders.

Here is how to use this in practice:

  <location path="." inheritInChildApplications="false">

    <system.web>
    ...

    </system.web>  
  </location>
14 years ago
Typically you would put it around the system.web section of the root site, in your case the DNN web.config. I am no expert with these things but I have used this method a few times.  Just doing a Google search on the location tag yields lots of information about it and some other options as mentioned in this msdn article http://msdn.microsoft.com/en-us/library/ms178685.aspx

good luck
14 years ago
My last attempt after checking msdn was this

<location path="store" inheritInChildApplications="false" allowOverride="false">

  <system.web>

----------

  </system.web>

</location>

Any web.config guru's out there?

Martin
14 years ago
Hi Martin,

do not install DNN in the root.

Please install DNN in a separate folder.
Make sure the the folder is a virtual folder for the webserver
and that the folder is an application.

In that way DNN and nopCommerce should use their own web.config file.

Hope that helps.
regards
Henner
13 years ago
Hi, I've converted nopCommerce into a DotNetNuke module, for more info, please visit this: www.sysdatanet.com
13 years ago
I know this post is a bit old - but I thought I would contribute a finding I had.

I originally created a sub folder under my DNN site and pointed my server's home directory to the sub directory to set up the store - The thought was just to see how the store worked. But I really like DNN's other features so I pointed the home directory back to the DNN site and worked on getting noCommerce working in a sub directory.

This is a first attempt hack - But this is what I did on IIS 6 to get the store to work in a sub directory of DNN. nopCommerce version 1.80 using SQLexpress running locally.

1. I created a sub folder called store.
2. This is where I put nopcommerce
3. In the DNN web config I added the following.


<location path="." inheritInChildApplications="false">

    <system.web>
    ...

    </system.web>  
  </location>


4. In IIS 6 - I turned the subfolder into an application named "store"
5. I also created a separate application pool called "storepool" and put my new store application in that pool
6. In the nopcommerce web config I removed targetFramework="4.0" attribute from the compilation tag (I am running .NET 4.0 on IIS)
7. In the nopcommerce connections.config I removed  <remove name="LocalSqlServer" />

It appears to work for me. Preliminary test appear good.

I am very interested in hearing if someone else takes this approach and does some better testing. This was my first attempt, so I am not sure if all the steps listed above are needed or if I should include some other steps in my solution. If I run into anything interesting I'll post it.
13 years ago
Your approach looks right Cory. You can have multiple ASP.NET sites on one subdomain, you just have to configure them as standalone so that the web.configs don't clash - as you have done.

I even have a seperate application in a virtual directory which uses a different form of authentication (public root uses Forms, subfolder admin area WinAuth).
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.