Blue Ink
Blue InkHomeBlue Ink SolutionsArticlesBlue Ink Net CommunityBlue Ink Demo ApplicationAbout Automated Architecture
My Profile
login/register
0

DB and IIS in different machines

View Blue Ink Issues Forum | Post Response | New Topic

Author Message
yashmi
Jun 1 2006
10:21 AM
I am trying to publish my web app. IIS and MS Sql server are located on two different machines. What do I need to change in my blue ink project in order to use the DB in the different machine?
Lee Richardson
(Admin)

Jun 1 2006
11:10 AM
Yashmi,

You can change the connection string from the DataAccess project in Helpers\DaoHelper.cs. I often put conditional compilation in this file to set the connection string depending on which computer it is loaded (production or development). I can post some code if this is of interest.
yashmi
Jun 1 2006
11:33 AM
Yes, please post the code, it will definitely help me. I made the change to the helper file in DAO and I am still having problems logging in to the DB server via the application. Here is the message I am getting when I try to login, "Login failed for user 'EDC\CMHES-AP03$'.". I created an 'aspnet' account in MS SQL
Lee Richardson
(Admin)

Jun 2 2006
8:08 AM
Yashmi,

It sounds like you are using windows authentication to connect between the application and the database (windowsauthentication=sspi in the connection string) and the application is using a local account (aspnet). In this case you need to manually tell the application which account to run under. You can do this in the web.config file as follows:

<identity impersonate="true"
userName="DOMAINNAME\USERNAME"
password="PASSWORD"/>

You can put this right before the </system.web> command. This will cause the application to run as the DOMAINNAME\USERNAME account. You will of course need to grant that account public access to the database and execute permission to all of the stored procedures (that's a best practice, you could just grant it dba privlidges for testing).

I don't have access to the conditional compilation code at present, but I will post back over the weekend with the sample code. Hope this helps.

- Lee
Lee Richardson
(Admin)

Jun 5 2006
7:35 AM
Yashmi,

As requested here is some sample code that provides different connection strings based upon the computer the application has been installed upon. It is placed in the static DaoHelper constructor so it is only run once (rather than for every db request).

static DaoHelper() {
    string strComputerName = Dns.GetHostName();
    switch (strComputerName.ToLower()) {
        case "server":
            strConnectionString = "xyz";
            break;
        default:
            strConnectionString = "abc";
            break;
    }
}

View Blue Ink Issues Forum | Post Response | New Topic






ARTICLES

What is Rapid Application Development?


QUESTIONS?

Call us toll free:
(877) 756-3595

Or Visit Forums

    

Copyright © 2017 Automated Architecture, Inc. All rights reserved.