views:

610

answers:

6

In asp.net 3.5, I have a problem that if I upload my global.asax to the remote web server, the app starts looking for my local sql server and eventually times out. I use a different config file for the local and remote because of the sql server login. Local is windows auth and remote is sql server auth. However, none of that info is stored in global.asax. global.asax only has

<%@ Application Inherits="myapp.Global" Language="C#" %>

but once it is uploaded, something causes the remote to try finding the local web.config's sql server login. Deleting global.asax on the remote causes everything to work fine.

Any ideas?

A: 

Have you checked the class it's inheriting from? It looks to be inheriting from myapp.Global

markmcdonald
A: 

Yes - that is the class it's inheriting from, which is valid. Maybe I'm not following your point.

4thSpace
+1  A: 

Dropping in the global.asax file that will cause the inherited class to be used, is there any code in the inherited class that could be causing changes?

The .asax maybe blank but that doesn't mean the inherited class is.

markmcdonald
A: 

Check to see if the myapp.Global class accesses either the Membership, Role, or Profile providers; the default settings for each use a local SQL server connection.

technophile
Nope - not using any of those three.
4thSpace
A: 

The global.asax.cs (inherited class) uses LINQ to access the DB. All of the DataContext (DBML) stuff is in a seperate DLL. All data access gets the connection string from web.config, which is set for the remote.

4thSpace
A: 

Ok, in the data access DLL, myapp.DataAccess.Properties has a

    [global::System.Configuration.DefaultSettingValueAttribute("Data Source=VISTADEV;Initial Catalog=Fin;Integrated Security=True")]
    public string FinConnectionString {
        get {
            return ((string)(this["FinConnectionString"]));
        }
    }

which is my local box. I see the problem though. In global.asax.cs, rather than doing:

using (DataAccess.FinDBDataContext context = new DataAccess.FinDBDataContext(Configuration.DbConnection))

I was doing

using (DataAccess.FinDBDataContext context = new DataAccess.FinDBDataContext())

which brings back the default rather than the config value. Problem solved. Thanks.

4thSpace