Reputation: 581
This code is written in WCF. when I add reference from localhost then this code works fine but when service reference is added from IIS then it fails in cn.Open() . It doesn't throw any exception and just hangs in this line.
OdbcConnection cn = new OdbcConnection();
cn.ConnectionString = "DSN=myDsn;Uid=myuid;Pwd=mypassword;";
cn.Open(); // Fails on this line
Or is there any other way which which I can get datasource name with dsn in C#?
Upvotes: 0
Views: 456
Reputation: 35879
Makes sure the DSN was created as a system DSN and not a user DSN. If it's created as a user DSN (as you) then the IIS service user will not have access to it.
Upvotes: 1