I am getting System.NullReferenceException: Object reference not set to an instance of an object at the connection.
OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["testdb"].ConnectionString);
The connection works fine when I debug from Visual studio but when I run from IIS I get null reference error.
My web.config file is located in the root:
<? xmlversion="1.0"?>
<configuration>
<connectionStrings>
<addname="testdb"connectionString="Data
Source=testds;User ID=testuser;Password=testpwd;Persist Security Info=True;Min Pool Size=10;Incr Pool Size=5;Decr Pool Size=7;Max Pool Size=75;"/>
sno
0 Points
5 Posts
System.NullReferenceException
Jun 21, 2012 05:19 PM|LINK
I am getting System.NullReferenceException: Object reference not set to an instance of an object at the connection.
OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["testdb"].ConnectionString);
The connection works fine when I debug from Visual studio but when I run from IIS I get null reference error.
My web.config file is located in the root:
<? xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="testdb" connectionString="Data Source=testds;User ID=testuser;Password=testpwd;Persist Security Info=True;Min Pool Size=10;Incr Pool Size=5;Decr Pool Size=7;Max Pool Size=75;"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=11111111111"/>
</assemblies>
</compilation>
</system.web>
MisterFantas...
Participant
1335 Points
380 Posts
Re: System.NullReferenceException
Jun 27, 2012 10:27 AM|LINK
Mostly web.config was not deployed .If error comes after this fix please let me know.
SKanyan
Member
20 Points
8 Posts
Re: System.NullReferenceException
Jun 28, 2012 09:17 AM|LINK
sno
Publish your application
put Oracle.DataAccess Assembly after seaching from your developement environment to bin folder of publish code
& run publish application through IIS