using <runtime> section in web.config file

Discussion in 'ASP .Net' started by Subra Mallampalli, Jan 20, 2005.

  1. Hi,

    I am trying to use <runtime> section within the web.config file. However,
    the contents of the <runtime> section seem to be ignored. What am i missing
    here? Is <runtime> section not used by web apps?

    Any help is greatly appreciated.

    Thanks,

    Subra
     
    Subra Mallampalli, Jan 20, 2005
    #1
    1. Advertising

  2. Do you mean <httpRuntime> ?



    Juan T. Llibre
    ASP.NET MVP
    ===========
    "Subra Mallampalli" <> wrote in
    message news:%233asbgz$...
    > Hi,
    >
    > I am trying to use <runtime> section within the web.config file. However,
    > the contents of the <runtime> section seem to be ignored. What am i
    > missing
    > here? Is <runtime> section not used by web apps?
    >
    > Any help is greatly appreciated.
    >
    > Thanks,
    >
    > Subra
    >
    >
     
    Juan T. Llibre, Jan 20, 2005
    #2
    1. Advertising

  3. No. <runtime> section is used to specify the binding policies for the .NET
    run time.
    For example:
    <configuration>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <probing privatePath="myBinFolder"/>
    <dependentAssembly>
    <assemblyIdentity name="myAssemblyName" />
    <codeBase href="myBinFolder2"/>
    </dependentAssembly>
    </assemblyBinding>
    </runtime>
    </configuration>

    Basically, I am looking for a mechanism to not use the standard bin folder
    for my web apps but instead use a common folder to store common dlls for a
    group of web apps w/o using the GAC.

    Thanks,

    Subra

    "Juan T. Llibre" <> wrote in message
    news:OXq8Unz$...
    > Do you mean <httpRuntime> ?
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > ===========
    > "Subra Mallampalli" <> wrote in
    > message news:%233asbgz$...
    > > Hi,
    > >
    > > I am trying to use <runtime> section within the web.config file.

    However,
    > > the contents of the <runtime> section seem to be ignored. What am i
    > > missing
    > > here? Is <runtime> section not used by web apps?
    > >
    > > Any help is greatly appreciated.
    > >
    > > Thanks,
    > >
    > > Subra
    > >
    > >

    >
    >
     
    Subra Mallampalli, Jan 21, 2005
    #3
  4. re:
    > "No. <runtime> section is used to specify..."


    Hi, Subra.

    It looks like <codebase href=" needs a web address :

    <configuration>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="myAssembly"
    publicKeyToken="32ab4ba45e0a69a1"
    culture="neutral" />
    <codeBase version="2.0.0.0"
    href="http://www.litwareinc.com/myAssembly.dll"/>
    </dependentAssembly>
    </assemblyBinding>
    </runtime>
    </configuration>

    See
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfCodeBase.asp



    Juan T. Llibre
    ASP.NET MVP
    ===========
    "Subra Mallampalli" <> wrote in
    message news:OBMe3N1$...
    > No. <runtime> section is used to specify the binding policies for the .NET
    > run time.
    > For example:
    > <configuration>
    > <runtime>
    > <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    > <probing privatePath="myBinFolder"/>
    > <dependentAssembly>
    > <assemblyIdentity name="myAssemblyName" />
    > <codeBase href="myBinFolder2"/>
    > </dependentAssembly>
    > </assemblyBinding>
    > </runtime>
    > </configuration>
    >
    > Basically, I am looking for a mechanism to not use the standard bin folder
    > for my web apps but instead use a common folder to store common dlls for a
    > group of web apps w/o using the GAC.
    >
    > Thanks,
    >
    > Subra
    >
    > "Juan T. Llibre" <> wrote in message
    > news:OXq8Unz$...
    >> Do you mean <httpRuntime> ?
    >>
    >>
    >>
    >> Juan T. Llibre
    >> ASP.NET MVP
    >> ===========
    >> "Subra Mallampalli" <> wrote in
    >> message news:%233asbgz$...
    >> > Hi,
    >> >
    >> > I am trying to use <runtime> section within the web.config file.

    > However,
    >> > the contents of the <runtime> section seem to be ignored. What am i
    >> > missing
    >> > here? Is <runtime> section not used by web apps?
    >> >
    >> > Any help is greatly appreciated.
    >> >
    >> > Thanks,
    >> >
    >> > Subra
    >> >
    >> >

    >>
    >>

    >
    >
     
    Juan T. Llibre, Jan 21, 2005
    #4
  5. Subra Mallampalli

    bruce barker Guest

    no its not.

    this is probably because the dll's are needed for the page compile first.
    the compiler references are specified in the <assemblies> section (which
    asp.net passes to the compiler thru switches when it spawns it).
    unfortunately you can only specify the name in the <assemblies> section, not
    the path, as this is specified with the compiler lib switch.

    -- bruce (sqlwork.com)


    "Subra Mallampalli" <> wrote in
    message news:%233asbgz$...
    | Hi,
    |
    | I am trying to use <runtime> section within the web.config file. However,
    | the contents of the <runtime> section seem to be ignored. What am i
    missing
    | here? Is <runtime> section not used by web apps?
    |
    | Any help is greatly appreciated.
    |
    | Thanks,
    |
    | Subra
    |
    |
     
    bruce barker, Jan 21, 2005
    #5
  6. Bruce,

    This is an interesting topic.

    It would seem that
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfCodeBase.asp
    implies that the codebase *can* be used by
    web applications, since that page specifies that:

    "If the assembly has a strong name, the codebase setting
    can be anywhere on the local intranet or the Internet.
    If the assembly is a private assembly, the codebase
    setting must be a path relative to the application's directory."

    and, it also specifies that :

    "This element can be used in the application configuration file,
    machine configuration file (machine.config), and the publisher
    policy file."

    I don't see any restrictions regarding usage only in Winforms.

    Also, the info in
    http://msdn.microsoft.com/library/d...guide/html/cpconconfiguringieapplications.asp
    states that:

    "The administrator can use the <probing> element in the configuration
    file to specify that the runtime should search for assemblies in
    subdirectories of the application base.

    Suppose that www.adventure-works.com/webApp/StockCalc
    maps to C:\Inetpub\Wwwroot\Webapps\StockCalc.

    Putting <probing privatePath="bin"/> in the configuration file
    causes the runtime to search for assemblies in
    C:\Inetpub\Wwwroot\Webapps\StockCalc\Bin
    as well as C:\Inetpub\Wwwroot\Webapps\StockCalc."

    The path "C:\Inetpub\Wwwroot\Webapps\StockCalc\Bin"
    strongly suggests that a web application is using the <probing>
    element to locate an assembly.

    I confess I'm not an expert in this field, but the implications
    of the statements in that page are very strong in favor of
    web applications being able to use the <runtime>
    configuration section of web.config.

    If I'm being misled by these documents,
    I'm ready to hear otherwise, though.




    Juan T. Llibre
    ASP.NET MVP
    ===========
    "bruce barker" <> wrote in message
    news:%23zAc3u1$...
    > no its not.
    >
    > this is probably because the dll's are needed for the page compile first.
    > the compiler references are specified in the <assemblies> section (which
    > asp.net passes to the compiler thru switches when it spawns it).
    > unfortunately you can only specify the name in the <assemblies> section,
    > not
    > the path, as this is specified with the compiler lib switch.
    >
    > -- bruce (sqlwork.com)
    >
    >
    > "Subra Mallampalli" <> wrote in
    > message news:%233asbgz$...
    > | Hi,
    > |
    > | I am trying to use <runtime> section within the web.config file.
    > However,
    > | the contents of the <runtime> section seem to be ignored. What am i
    > missing
    > | here? Is <runtime> section not used by web apps?
    > |
    > | Any help is greatly appreciated.
    > |
    > | Thanks,
    > |
    > | Subra
    > |
    > |
    >
    >
     
    Juan T. Llibre, Jan 21, 2005
    #6
  7. Subra Mallampalli

    Scott Allen Guest

    Yes, what you can do is specify another subdir to probe for assemblies, ie:

    <configuration>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <probing privatePath="Foo/bin" />
    </assemblyBinding>
    </runtime>
    <configuration>

    If the codebehind for an ASPX file is compiled into the assembly in Foo/bin,
    the @ Assembly directive can be used to link the two:

    <%@ Assembly Name="Foo" %>
    <%@ Import Namespace="FooNamespace" %>
    <%@ Page language="c#" Codebehind="Foo.aspx.cs" AutoEventWireup="false" Inherits="FooNamespace.FooWebForm"
    "%>

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    > Bruce,
    >
    > This is an interesting topic.
    >
    > It would seem that
    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgen
    > ref/html/gngrfCodeBase.asp
    > implies that the codebase *can* be used by
    > web applications, since that page specifies that:
    > "If the assembly has a strong name, the codebase setting can be
    > anywhere on the local intranet or the Internet. If the assembly is a
    > private assembly, the codebase setting must be a path relative to the
    > application's directory."
    >
    > and, it also specifies that :
    >
    > "This element can be used in the application configuration file,
    > machine configuration file (machine.config), and the publisher policy
    > file."
    >
    > I don't see any restrictions regarding usage only in Winforms.
    >
    > Also, the info in
    >
    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgui
    > de/html/cpconconfiguringieapplications.asp
    >
    > states that:
    >
    > "The administrator can use the <probing> element in the configuration
    > file to specify that the runtime should search for assemblies in
    > subdirectories of the application base.
    >
    > Suppose that www.adventure-works.com/webApp/StockCalc maps to
    > C:\Inetpub\Wwwroot\Webapps\StockCalc.
    >
    > Putting <probing privatePath="bin"/> in the configuration file
    > causes the runtime to search for assemblies in
    > C:\Inetpub\Wwwroot\Webapps\StockCalc\Bin
    > as well as C:\Inetpub\Wwwroot\Webapps\StockCalc."
    > The path "C:\Inetpub\Wwwroot\Webapps\StockCalc\Bin"
    > strongly suggests that a web application is using the <probing>
    > element to locate an assembly.
    > I confess I'm not an expert in this field, but the implications
    > of the statements in that page are very strong in favor of
    > web applications being able to use the <runtime>
    > configuration section of web.config.
    > If I'm being misled by these documents,
    > I'm ready to hear otherwise, though.
    > Juan T. Llibre
    > ASP.NET MVP
    > ===========
    > "bruce barker" <> wrote in message
    > news:%23zAc3u1$...
    >> no its not.
    >>
    >> this is probably because the dll's are needed for the page compile
    >> first.
    >> the compiler references are specified in the <assemblies> section
    >> (which
    >> asp.net passes to the compiler thru switches when it spawns it).
    >> unfortunately you can only specify the name in the <assemblies>
    >> section,
    >> not
    >> the path, as this is specified with the compiler lib switch.
    >> -- bruce (sqlwork.com)
    >>
    >> "Subra Mallampalli" <>
    >> wrote in
    >> message news:%233asbgz$...
    >> | Hi,
    >> |
    >> | I am trying to use <runtime> section within the web.config file.
    >> However,
    >> | the contents of the <runtime> section seem to be ignored. What am i
    >> missing
    >> | here? Is <runtime> section not used by web apps?
    >> |
    >> | Any help is greatly appreciated.
    >> |
    >> | Thanks,
    >> |
    >> | Subra
    >> |
    >> |
     
    Scott Allen, Jan 21, 2005
    #7
  8. Scott,

    Thanks! the Assembly directive was the piece I was missing. I was thinking
    that the framework would automatically probe all the folders specified in
    <probing> and try to load the type, but it seems that it doesn't do that.

    If I were to specify the full type for the inherits attribute of the page
    directive (Inhertis="FooNamespace.FooWebForm, FooAssemblyName"), it works
    like a charm. With this change, I dont need the assembly or the imports
    directives (we use XSL transforms and our aspx pages have no code).

    However the <runtime> tag is effective only in the web.config file in the
    application folder (and not in the subfolders). So, if i want to maintain
    sub applications in subfolders with their own bin folders, I will have to
    modify the root web.config file to include details about every subfolder.

    Also, it is not clear to me if a dll change in one of the probing folders
    would automatically reload the entire web application.

    Thanks, again!

    Subra

    "Scott Allen" <> wrote in message
    news:...
    > Yes, what you can do is specify another subdir to probe for assemblies,

    ie:
    >
    > <configuration>
    > <runtime>
    > <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    > <probing privatePath="Foo/bin" />
    > </assemblyBinding>
    > </runtime>
    > <configuration>
    >
    > If the codebehind for an ASPX file is compiled into the assembly in

    Foo/bin,
    > the @ Assembly directive can be used to link the two:
    >
    > <%@ Assembly Name="Foo" %>
    > <%@ Import Namespace="FooNamespace" %>
    > <%@ Page language="c#" Codebehind="Foo.aspx.cs" AutoEventWireup="false"

    Inherits="FooNamespace.FooWebForm"
    > "%>
    >
    > --
    > Scott
    > http://www.OdeToCode.com/blogs/scott/
    >
    > > Bruce,
    > >
    > > This is an interesting topic.
    > >
    > > It would seem that
    > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgen
    > > ref/html/gngrfCodeBase.asp
    > > implies that the codebase *can* be used by
    > > web applications, since that page specifies that:
    > > "If the assembly has a strong name, the codebase setting can be
    > > anywhere on the local intranet or the Internet. If the assembly is a
    > > private assembly, the codebase setting must be a path relative to the
    > > application's directory."
    > >
    > > and, it also specifies that :
    > >
    > > "This element can be used in the application configuration file,
    > > machine configuration file (machine.config), and the publisher policy
    > > file."
    > >
    > > I don't see any restrictions regarding usage only in Winforms.
    > >
    > > Also, the info in
    > >
    > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgui
    > > de/html/cpconconfiguringieapplications.asp
    > >
    > > states that:
    > >
    > > "The administrator can use the <probing> element in the configuration
    > > file to specify that the runtime should search for assemblies in
    > > subdirectories of the application base.
    > >
    > > Suppose that www.adventure-works.com/webApp/StockCalc maps to
    > > C:\Inetpub\Wwwroot\Webapps\StockCalc.
    > >
    > > Putting <probing privatePath="bin"/> in the configuration file
    > > causes the runtime to search for assemblies in
    > > C:\Inetpub\Wwwroot\Webapps\StockCalc\Bin
    > > as well as C:\Inetpub\Wwwroot\Webapps\StockCalc."
    > > The path "C:\Inetpub\Wwwroot\Webapps\StockCalc\Bin"
    > > strongly suggests that a web application is using the <probing>
    > > element to locate an assembly.
    > > I confess I'm not an expert in this field, but the implications
    > > of the statements in that page are very strong in favor of
    > > web applications being able to use the <runtime>
    > > configuration section of web.config.
    > > If I'm being misled by these documents,
    > > I'm ready to hear otherwise, though.
    > > Juan T. Llibre
    > > ASP.NET MVP
    > > ===========
    > > "bruce barker" <> wrote in message
    > > news:%23zAc3u1$...
    > >> no its not.
    > >>
    > >> this is probably because the dll's are needed for the page compile
    > >> first.
    > >> the compiler references are specified in the <assemblies> section
    > >> (which
    > >> asp.net passes to the compiler thru switches when it spawns it).
    > >> unfortunately you can only specify the name in the <assemblies>
    > >> section,
    > >> not
    > >> the path, as this is specified with the compiler lib switch.
    > >> -- bruce (sqlwork.com)
    > >>
    > >> "Subra Mallampalli" <>
    > >> wrote in
    > >> message news:%233asbgz$...
    > >> | Hi,
    > >> |
    > >> | I am trying to use <runtime> section within the web.config file.
    > >> However,
    > >> | the contents of the <runtime> section seem to be ignored. What am i
    > >> missing
    > >> | here? Is <runtime> section not used by web apps?
    > >> |
    > >> | Any help is greatly appreciated.
    > >> |
    > >> | Thanks,
    > >> |
    > >> | Subra
    > >> |
    > >> |

    >
    >
     
    Subra Mallampalli, Jan 21, 2005
    #8
  9. Subra Mallampalli

    Scott Allen Guest

    Hi Subra:

    Glad to help out.

    As for the last question (does a overwriting an assembly in the probing folder
    reload the app?) - I'm not sure. My guess is no.

    I'm pretty sure the runtime won't even shadow copy these assemblies because
    only the bin directory is setup for shadow copy. You might not be able to
    overwrite those assemblies without an iisreset. Not 100% sure on this however
    - would need to verify with an experiment.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    > Scott,
    >
    > Thanks! the Assembly directive was the piece I was missing. I was
    > thinking that the framework would automatically probe all the folders
    > specified in <probing> and try to load the type, but it seems that it
    > doesn't do that.
    >
    > If I were to specify the full type for the inherits attribute of the
    > page directive (Inhertis="FooNamespace.FooWebForm, FooAssemblyName"),
    > it works like a charm. With this change, I dont need the assembly or
    > the imports directives (we use XSL transforms and our aspx pages have
    > no code).
    >
    > However the <runtime> tag is effective only in the web.config file in
    > the application folder (and not in the subfolders). So, if i want to
    > maintain sub applications in subfolders with their own bin folders, I
    > will have to modify the root web.config file to include details about
    > every subfolder.
    >
    > Also, it is not clear to me if a dll change in one of the probing
    > folders would automatically reload the entire web application.
    >
    > Thanks, again!
    >
    > Subra
    >
    > "Scott Allen" <> wrote in message
    > news:...
    >
    >> Yes, what you can do is specify another subdir to probe for
    >> assemblies,
    >>

    > ie:
    >
    >> <configuration>
    >> <runtime>
    >> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    >> <probing privatePath="Foo/bin" />
    >> </assemblyBinding>
    >> </runtime>
    >> <configuration>
    >> If the codebehind for an ASPX file is compiled into the assembly in
    >>

    > Foo/bin,
    >
    >> the @ Assembly directive can be used to link the two:
    >>
    >> <%@ Assembly Name="Foo" %>
    >> <%@ Import Namespace="FooNamespace" %>
    >> <%@ Page language="c#" Codebehind="Foo.aspx.cs"
    >> AutoEventWireup="false"

    > Inherits="FooNamespace.FooWebForm"
    >
    >> "%>
    >>
    >> --
    >> Scott
    >> http://www.OdeToCode.com/blogs/scott/
    >>> Bruce,
    >>>
    >>> This is an interesting topic.
    >>>
    >>> It would seem that
    >>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpg
    >>> en
    >>> ref/html/gngrfCodeBase.asp
    >>> implies that the codebase *can* be used by
    >>> web applications, since that page specifies that:
    >>> "If the assembly has a strong name, the codebase setting can be
    >>> anywhere on the local intranet or the Internet. If the assembly is a
    >>> private assembly, the codebase setting must be a path relative to
    >>> the
    >>> application's directory."
    >>> and, it also specifies that :
    >>>
    >>> "This element can be used in the application configuration file,
    >>> machine configuration file (machine.config), and the publisher
    >>> policy file."
    >>>
    >>> I don't see any restrictions regarding usage only in Winforms.
    >>>
    >>> Also, the info in
    >>>
    >>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpg
    >>> ui de/html/cpconconfiguringieapplications.asp
    >>>
    >>> states that:
    >>>
    >>> "The administrator can use the <probing> element in the
    >>> configuration file to specify that the runtime should search for
    >>> assemblies in subdirectories of the application base.
    >>>
    >>> Suppose that www.adventure-works.com/webApp/StockCalc maps to
    >>> C:\Inetpub\Wwwroot\Webapps\StockCalc.
    >>>
    >>> Putting <probing privatePath="bin"/> in the configuration file
    >>> causes the runtime to search for assemblies in
    >>> C:\Inetpub\Wwwroot\Webapps\StockCalc\Bin
    >>> as well as C:\Inetpub\Wwwroot\Webapps\StockCalc."
    >>> The path "C:\Inetpub\Wwwroot\Webapps\StockCalc\Bin"
    >>> strongly suggests that a web application is using the <probing>
    >>> element to locate an assembly.
    >>> I confess I'm not an expert in this field, but the implications
    >>> of the statements in that page are very strong in favor of
    >>> web applications being able to use the <runtime>
    >>> configuration section of web.config.
    >>> If I'm being misled by these documents,
    >>> I'm ready to hear otherwise, though.
    >>> Juan T. Llibre
    >>> ASP.NET MVP
    >>> ===========
    >>> "bruce barker" <> wrote in message
    >>> news:%23zAc3u1$...
    >>>> no its not.
    >>>>
    >>>> this is probably because the dll's are needed for the page compile
    >>>> first.
    >>>> the compiler references are specified in the <assemblies> section
    >>>> (which
    >>>> asp.net passes to the compiler thru switches when it spawns it).
    >>>> unfortunately you can only specify the name in the <assemblies>
    >>>> section,
    >>>> not
    >>>> the path, as this is specified with the compiler lib switch.
    >>>> -- bruce (sqlwork.com)
    >>>> "Subra Mallampalli" <>
    >>>> wrote in
    >>>> message news:%233asbgz$...
    >>>> | Hi,
    >>>> |
    >>>> | I am trying to use <runtime> section within the web.config file.
    >>>> However,
    >>>> | the contents of the <runtime> section seem to be ignored. What am
    >>>> i
    >>>> missing
    >>>> | here? Is <runtime> section not used by web apps?
    >>>> |
    >>>> | Any help is greatly appreciated.
    >>>> |
    >>>> | Thanks,
    >>>> |
    >>>> | Subra
    >>>> |
    >>>> |
     
    Scott Allen, Jan 21, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QXVndXN0aW4gUHJhc2FubmEuIEo=?=

    Web.Config Get Config settings at runtime.

    =?Utf-8?B?QXVndXN0aW4gUHJhc2FubmEuIEo=?=, Feb 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,273
    Kevin Spencer
    Feb 6, 2004
  2. clintonG
    Replies:
    4
    Views:
    357
    clintonG
    Aug 24, 2006
  3. Brian McCullough
    Replies:
    0
    Views:
    500
    Brian McCullough
    Feb 16, 2007
  4. CSharpner
    Replies:
    0
    Views:
    1,052
    CSharpner
    Apr 9, 2007
  5. kampy
    Replies:
    9
    Views:
    339
    Steven D'Aprano
    Oct 19, 2012
Loading...

Share This Page