Global.asax, Multiple VirtualDirectory

Discussion in 'ASP .Net Web Services' started by Fek, Apr 5, 2005.

  1. Fek

    Fek Guest

    Hi,

    here the situation:
    My purpose is to have one physical directory(PD) (c:\webapplication) and a
    lot of virtual directory(VD) pointing to the physical directory. Each VD must
    be independant of another one. (resources not shared, if one fails the other
    don't)

    Configuration:
    - Windows 2000 Pro
    - IIS 5
    - .NET 1.1.4322
    - <ProcessModel enable="false"> in machine.config (because i dont want to
    use aspnet_wp.exe)
    - In PD, we have "global.asax, Service1.asmx...."
    - Each VD is configured as a web application (isolation outprocess,
    uniqueName)
    - A ServerLog to write in a console some debug
    - using C# (not important)

    Code:
    - Client: (A windows application)
    * Using a proxy, generated by Visual Studio, to access the webservice

    - Service1.asmx.cs:
    * static int iVariableForDebug = 0;
    Service1()
    {
    ServerLog.write("webservice constructor");
    }

    [WebMethod]
    public String GetInfo()
    {
    Interlocked.Increment(ref iVariableForDebug);
    ServerLog.write("webservice Method");
    return ("some info: " + iVariableForDebug.toString());
    }

    - Global.asax.cs:
    * Global()
    {
    ServerLog.write("Global constructor")
    }

    protected void Application_Start(Object sender, EventArgs e);
    {
    ServerLog.write("Application started ....." );
    }

    - 2 WebApplication:
    * WB1, WB2

    Test:(All the action are made successively)

    - Client1:
    * WebserviceProxy = new WebserviceProxy();
    WebserviceProxy.Url = "http://localhost/WB1/Servce1.asmx"
    WebserviceProxy.GetInfo();
    output:
    Global constructor
    Application started
    webservice constructor
    webservice Method
    some info: 1

    * Proxy.GetInfo();
    output:
    webservice constructor
    webservice Method
    some info: 2

    - Client2:
    * WebserviceProxy = new WebserviceProxy();
    WebserviceProxy.Url = "http://localhost/WB2/Servce1.asmx"
    WebserviceProxy.GetInfo();
    output:
    Global constructor
    Application started
    webservice constructor
    webservice Method
    some info: 1

    => - WB1 and WB2 have their own static variable
    - each WB has its own Global

    - We delete, from IIS, the WebApplication WB1

    - Client1:
    * Proxy.GetInfo();
    output: Error ... Not Found etc...

    - We re-create, in IIS, the WebApplication WB1

    - Client1:
    * Proxy.GetInfo();
    output:
    webservice constructor
    webservice Method
    some info: 3

    Questions:
    1) Why, every time we call a method in webservice, the constructor is also
    called?
    2) Why, even if we delete the webapplication from IIS, the static variable
    still living?
    2.1) is there a way to force a webapplication to dispose, without affecting
    the other one? (considering my configuration)

    I hope you will understand the problem
    Thank you in advance for your response
    Fek, Apr 5, 2005
    #1
    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. VSK
    Replies:
    1
    Views:
    779
    Alvin Bruney
    Jul 29, 2003
  2. Daniel Bass
    Replies:
    2
    Views:
    6,872
    Daniel Bass
    Dec 31, 2003
  3. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    825
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  4. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,153
    Mark Rae
    May 23, 2006
  5. =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=

    ProductName vs. VirtualDirectory in web setup project

    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=, Nov 10, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    409
    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=
    Nov 10, 2006
Loading...

Share This Page