Switching from development server to IIS gives "Error: Object reference not set to an instance of an object"

Last post 09-25-2008 4:49 AM by malec1984. 4 replies.

Sort Posts:

  • Switching from development server to IIS gives "Error: Object reference not set to an instance of an object"

    02-20-2008, 12:23 PM

    Hi all,

       I've been beating my head against the wall for three days now with this and it's more than likely going to be something really silly but I'm a man on the edge! :)

     I have written a very simple app to test running reports via a web browser using visual weeb developer express 2008. It all works perfectly well when I run it from the little develpment/test server that runs when you debug but if I then copy the site to my IIS sever i get the error:

    Load Report Failed

    CrystalReportViewer - CrystalReportViewer1
    Error: Object reference not set to an instance of an object

    I've done all kind of fiddling with my IIS server but to no avail.

    Code is below:

     ASPX Page

     

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <%@ Register TagPrefix="cr" Namespace="CrystalDecisions.Web" Assembly="CrystalDecisions.Web, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>

    <%@ Register TagPrefix="ctrls" Namespace="CrystalDecisions.ReportAppServer.Controllers" Assembly="CrystalDecisions.ReportAppServer.Controllers, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>

    <%@ Register TagPrefix="engine" Namespace="CrystalDecisions.CrystalReports.Engine" Assembly="CrystalDecisions.CrystalReports.Engine, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>

    <%@ Register TagPrefix="rptsrc" Namespace="CrystalDecisions.ReportSource" Assembly="CrystalDecisions.ReportSource, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>

    <%@ Register TagPrefix="ser" Namespace="CrystalDecisions.ReportAppServer.XmlSerialize" Assembly="CrystalDecisions.ReportAppServer.XmlSerialize, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>

    <%@ Register TagPrefix="objfact" Namespace="CrystalDecisions.ReportAppServer.ObjectFactory" Assembly="CrystalDecisions.ReportAppServer.ObjectFactory, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>

     

    <%
    @ Import Namespace="CrystalDecisions.ReportAppServer.Controllers" %>

    <%@ Import Namespace="CrystalDecisions.CrystalReports.Engine" %>

    <%@ Import Namespace="CrystalDecisions.ReportSource" %><%@ Import Namespace="CrystalDecisions.Web" %>

     

     

    <script runat="server" language="VB">

    Protected Overrides Sub OnInit(ByVal e As System.EventArgs)

    MyBase.OnInit(e)

    Dim viewer As CrystalDecisions.Web.CrystalReportViewer

    'Response.ExpiresAbsolute = Now()

     

    'CrystalReportViewer1 = New CrystalDecisions.Web.CrystalReportViewer

    viewer = CrystalReportViewer1

     

    viewer.ReportSource = "\\Mainserver\Company\Data\Gift\Administration\Shelley\stats.rpt"

    End Sub</script>

     

     

    <!
    DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <HTML>

    <HEAD>

    <title>SoloLogic Web Report Viewer</title>

    </HEAD>

    <body>

    <form id=Form1 method="post" runat="server">

    <CR:CrystalReportViewer

    id="CrystalReportViewer1"

    runat="server"

    HasRefreshButton = true

    HasExportButton = true

    HasPrintButton = true

    >

    </CR:CrystalReportViewer>

    </form>

    </body>

    </HTML>

     

    web.config 

    <?xml version="1.0"?><!--

    Note: As an alternative to hand editing this file you can use the

    web admin tool to configure settings for your application. Use

    the Website->Asp.Net Configuration option in Visual Studio.

    A full list of settings and comments can be found in

    machine.config.comments usually located in

    \Windows\Microsoft.Net\Framework\v2.x\Config

    -->

    <
    configuration>

    <configSections>

    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

    <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>

    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

    </sectionGroup>

    </sectionGroup>

    </sectionGroup>

    </configSections>

    <connectionStrings/>

    <system.web>

    <httpRuntime executionTimeout="360" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/><!--

    Set compilation debug="true" to insert debugging

    symbols into the compiled page. Because this

    affects performance, set this value to true only

    during development.

    -->

    <compilation debug="true">

    <assemblies>

    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

    <add assembly="CrystalDecisions.CrystalReports.Engine, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

    <add assembly="CrystalDecisions.Shared, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

    <add assembly="CrystalDecisions.ReportSource, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

    <add assembly="CrystalDecisions.Web, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

    </assemblies>

    </compilation>

    <!--

    The <authentication> section enables configuration

    of the security authentication mode used by

    ASP.NET to identify an incoming user.

    -->

    <authentication mode="Windows"/>

    <!--

    The <customErrors> section enables configuration

    of what to do if/when an unhandled error occurs

    during the execution of a request. Specifically,

    it enables developers to configure html error pages

    to be displayed in place of a error stack trace.

    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

    <error statusCode="403" redirect="NoAccess.htm" />

    <error statusCode="404" redirect="FileNotFound.htm" />

    </customErrors>

    -->

    <pages>

    <controls>

    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </controls>

    </pages>

    <httpHandlers>

    <remove verb="*" path="*.asmx"/>

    <add verb="*" path="*.csp" type="BusinessObjects.Enterprise.WebComponentAdapter.WCAHandler,BusinessObjects.Enterprise.WCA, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

    <add verb="*" path="*.cwr" type="BusinessObjects.Enterprise.WebComponentAdapter.WCAHandler,BusinessObjects.Enterprise.WCA, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>

    </httpHandlers>

    <httpModules>

    <clear/>

    <add name="Session" type="System.Web.SessionState.SessionStateModule"/>

    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </httpModules>

    </system.web>

    <system.codedom>

    <compilers>

    <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

    <providerOption name="CompilerVersion" value="v3.5"/>

    <providerOption name="OptionInfer" value="true"/>

    <providerOption name="WarnAsError" value="false"/>

    </compiler>

    </compilers>

    </system.codedom>

    <!--

    The system.webServer section is required for running ASP.NET AJAX under Internet

    Information Services 7.0. It is not necessary for previous version of IIS.

    -->

    <system.webServer>

    <validation validateIntegratedModeConfiguration="false"/>

    <modules>

    <remove name="ScriptModule"/>

    <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </modules>

    <handlers>

    <remove name="WebServiceHandlerFactory-Integrated"/>

    <remove name="ScriptHandlerFactory"/>

    <remove name="ScriptHandlerFactoryAppServices"/>

    <remove name="ScriptResource"/>

    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </handlers>

    </system.webServer>

    <appSettings>

    <clear/>

    <add key="path.dhtmlViewer" value="/crystalreportviewers115"/>

    <add key="viewer.defaultPage" value="viewrpt.aspx"/>

    <add key="defaultPage" value="enterprise115/desktoplaunch/en/default.htm"/>

    <add key="wca.Name" value="%DOTNET_WCA_NAME%"/>

    <add key="connection.cms" value="%CMS_NAME_AND_PORT%"/>

    <add key="connection.criTimeout"/>

    <add key="connection.socksUri"/>

    <add key="CMC_CUSTOMURL_PATH" value="webadmin/"/>

    <add key="crimage.tempImageDir"/>

    <add key="viewrpt.drillDown"/>

    <add key="viewrpt.groupTreeGenerate"/>

    <add key="viewrpt.groupTreeShow"/>

    <add key="viewrpt.refresh"/>

    <add key="viewrpt.search"/>

    <add key="viewrpt.export"/>

    <add key="viewrpt.zoom"/>

    <add key="viewrpt.print"/>

    <add key="viewrpt.logo"/>

    <add key="viewrpt.toolbar"/>

    <add key="wcalog"/>

    </appSettings>

    <runtime>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

    <dependentAssembly>

    <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>

    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>

    </dependentAssembly>

    <dependentAssembly>

    <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>

    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>

    </dependentAssembly>

    </assemblyBinding>

    </runtime>

    </configuration>

     

    All help will be greatly apperciated!

     

    Thanks,

    Dave

  • Re: Switching from development server to IIS gives "Error: Object reference not set to an instance of an object"

    02-20-2008, 12:24 PM
    • All-Star
      49,003 point All-Star
    • Curt_C
    • Member since 07-23-2003, 8:27 PM
    • Plover, WI - USA
    • Posts 5,334
    • Moderator
      TrustedFriends-MVPs

    what version of .Net is your IIS server set to use for this site? Your code is using 3.5, ensure that your server is also set for this....

    Blatant Self-Promotion: Book Released - ASP.Net CMS Development
  • Re: Switching from development server to IIS gives "Error: Object reference not set to an instance of an object"

    02-21-2008, 4:23 AM

    Server is running version 2.0.50727 which reading around the web should work as 3.5 is simply an extension of 2.0, is this correct?

    if so any other ideas as to what could be causing my issue?

     Many Thanks,

    Dave

  • Re: Switching from development server to IIS gives "Error: Object reference not set to an instance of an object"

    02-21-2008, 7:26 AM
    Answer

    Fixed this issue, turns out it was because the report I was attempting to open was on the network and the asp.net user account obviously had no access rights on the domain to get at the network so I set up impersonation in the web.config so that my application now runs as an valid domain login.

     Nice to get it sorted but now I have to figure out why it wont let me past the login screen for the database now..... Tongue Tied

  • Re: Switching from development server to IIS gives "Error: Object reference not set to an instance of an object"

    09-25-2008, 4:49 AM
    • Member
      2 point Member
    • malec1984
    • Member since 09-25-2008, 4:48 AM
    • Posts 1
    try use "identity impersonate" in web.config. This options allow use integrated anonymous authentication for logon http://msdn.microsoft.com/en-us/library/aa292118(VS.71).aspx
Page 1 of 1 (5 items)