locked
System.NullReferenceException RRS feed

  • Question

  • User-54348429 posted

    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>

    Thursday, June 21, 2012 1:19 PM

All replies

  • User581921910 posted

    Mostly web.config was not deployed .If error comes after this fix please let me know.

    Wednesday, June 27, 2012 6:27 AM
  • User1405945375 posted

    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 

    Thursday, June 28, 2012 5:17 AM