problems redirecting subdomain to subdirectory

Discussion in 'General troubleshooting' started by trotter, Jan 30, 2011.

  1. hi there

    im trying to get a sub domain set up and working.
    the main domian is cravenby.com the sub domain is forum.cravenby.com
    i added the subdomain in the control panel

    all the files for cravenby.com are in the root directory along with a forum subfolder which i am trying to set up as an application.

    I implemented the url rewrite rule in IIS and then browsed to forum.cravenby.com and got this error :

    It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.

    so i did some googling and then went and added the forum directory as an application in iis

    now when i try to browse to the forum its giving me an error where its trying to load a namespace from the root application web.config

    why it cant find that namespace i dunno because the main site works fine but
    its obviously not routing properly if its trying to read that config file.

    i did the url rewriting as follows:

    pattern .*

    added a condition:

    {HTTP_HOST} Matches the pattern ^(forum.)?cravenby.com$
    {PATH_INFO} does not match the pattern ^/forum/

    any ideas please? its my first time using url rewrite.
     
  2. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  3. Hi Ray
    thanks for your reply

    /forum is listed as an application starting point in my control panel?
    still no luck
     
  4. hi ray

    url rewriting aside, i removed the url rewrite rule and then just went straight to www.cravenby.com/forum and its still getting that error where its trying to read the config file form the main app, i have set it up as an application like you said, have a look for yourself, essentially i dont mind what the url looks like for now

    any ideas?
     
  5. rum

    rum Winhost Staff

    This happens probably because the web.config file in your subfolder inherited some configurations from the web.config of the parent (root) directory. What I'd recommend doing is to temporarily remove web.config file from your root and re-install your web application in your subfolder. This will prevent it from inheriting configurations from your parent web.config.
     
  6. hi rum

    thanks man that works!
     
  7. oh dear!

    once i re added the webconfig for the main app i get this error?

    Parser Error Message: The entry 'ApplicationServices' has already been added.

    Source Error:


    Line 24: <appSettings/>
    Line 25: <connectionStrings>
    Line 26: <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
    Line 27: <add name="ASPNETDBConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
    Line 28: </connectionStrings>


    Source File: E:\web\cravenby\forum\web.config Line: 26

    it doesnt seem to like the fact that both apps have membership connection strings
     
  8. i think i might roll my own membership for the main app as i was worried about the 2 membership systems conflicting, ive had it before with 2 visual studio windows open and then managing to log on to the one app through the other although i imagine that's just a cache thing with the browser
     
  9. Ray

    Ray

Share This Page