I'm using the Oracle ManagedDataAccess driver to access a database from a .NET Web Application. When running it locally under IIS Express as windows user x this works fine, but when I publish my site to another server with IIS I get error
ORA-01017: Invalid username/password; login denied
I viewed attempted logins from Oracle as outlined here. Where logins were successful from IIS I can see my windows username listed, OPS$(USERNAME).
Interestingly, where logins are unsuccessful, from IIS, I see the wrong username being passed - Username = OPS$(NAME_OF_MY_WEB_APPLICATION). I have no idea where it is getting the idea to substitute the name of the application as a username.
My connection string is the same for both environments: User ID=/;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP))(HOST=...(PORT=1521)(CONNECT_DATA=(SERVICE_NAME=...)));
Turns out impersonation was disabled in IIS, adding
<identity impersonate="true" />
to my web.config solved the issue. My Oracle driver was using the name of the app pool user which was the same as my web application.