user270014
user270014

Reputation: 581

connection not opening from WCF with dsn

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

Answers (1)

Peter Ritchie
Peter Ritchie

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

Related Questions