constant errors - any thoughts?

constant errors - any thoughts?

Old forum URL: forums.lhotka.net/forums/t/1656.aspx


kriscash posted on Wednesday, November 01, 2006

The error:

Server Error in '/PTWebcs' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 171:        if (proxy.IsServerRemote)
Line 172: ApplicationContext.SetGlobalContext(result.GlobalContext);
Line 173: throw new DataPortalException("DataPortal.Fetch " +
Line 174: Resources.Failed, ex.InnerException, result.ReturnObject);
Line 175: }

Source File: D:\ExpertBusinessObjects\csla20cs\Csla\DataPortal\Client\DataPortal.cs    Line: 173

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]

[CallMethodException: DataPortal_Fetch method call failed]

[DataPortalException: DataPortal.Fetch failed]
Csla.DataPortal.Fetch(Object criteria) in D:\ExpertBusinessObjects\csla20cs\Csla\DataPortal\Client\DataPortal.cs:173
Csla.DataPortal.Fetch(Object criteria) in D:\ExpertBusinessObjects\csla20cs\Csla\DataPortal\Client\DataPortal.cs:138
ProjectTracker.Library.Security.PTIdentity.GetIdentity(String username, String password) in D:\ExpertBusinessObjects\ProjectTracker20cs\ProjectTracker.Library\Security\PTIdentity.cs:57
ProjectTracker.Library.Security.PTPrincipal.Login(String username, String password) in D:\ExpertBusinessObjects\ProjectTracker20cs\ProjectTracker.Library\Security\PTPrincipal.cs:15
PTMembershipProvider.ValidateUser(String username, String password) in d:\ExpertBusinessObjects\ProjectTracker20cs\www\PTWeb\App_Code\PTMembershipProvider.cs:11
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160
System.Web.UI.WebControls.Login.AttemptLogin() +105
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Bayu replied on Wednesday, November 01, 2006

I'm a VB guy, so I don't have the csharp version of this sample here.

But apparently you should have a look at line 57 of PTIdentity.cs ... somehow a null-reference is thrown there.

What happens on there?

Bayu


david.wendelken replied on Wednesday, November 01, 2006

Have you ever gotten into the application successfully, or is this a post-installation issue?

Assuming this is an initial installation issue...

Can we see the contents of these tags in your web.config file?

<appSettings>

<Authentication>

What is your IIS website security setting?

What is your Project startup option (custom or...)

 

kriscash replied on Thursday, November 02, 2006

Yes this is an installation issue
>>Can we see the contents of these tags in your web.config file?

<appSettings>
    <add key="CslaAuthentication" value="Csla" />
    <!--<add key="CslaDataPortalProxy"
      value="Csla.DataPortalClient.RemotingProxy, Csla"/>
    <add key="CslaDataPortalUrl"
      value="http://localhost:3187/RemotingHost/RemotingPortal.rem"/>-->
    <!--<add key="CslaDataPortalProxy"
      value="Csla.DataPortalClient.WebServicesProxy, Csla"/>
    <add key="CslaDataPortalUrl"
      value="http://localhost:4334/WebServicesHost/WebServicePortal.asmx"/>-->
    <add key="CslaDataPortalProxy"
             value="EnterpriseServicesHost.EnterpriseServicesProxy, EnterpriseServicesHostcs"/>
  </appSettings>


<authentication mode="Forms">
      <forms loginUrl="Login.aspx" name="ptracker"/>
    </authentication>
    <authorization>
      <allow users="*"/>
    </authorization>

>>What is your IIS website security setting?

It's setup to default without any changes

>>What is your Project startup option (custom or...)

It's http://localhost/PTWebcs


Problem is still unresolved.

david.wendelken replied on Friday, November 03, 2006

Sorry for the delay getting back to you - crazy day at the office!

Are you sure you want to use the CslaDataPortalProxy?  It's not necessary unless you really want to connect to the database via a com object. 

If you *do* want to use the above method, there are some very specific setup instructions in the book to follow. I was able to get that method to work when I followed them.

If you don't want to connect via a com object - my recommendation unless you know why you need a com object :) - just fill in the connect string correctly and comment out the CslaDataPortalProxy entry.  My connection strings are for SqlServer, not SqlServer express (which is what is in the sample application).

<connectionStrings>

<add name="PTracker"
connectionString="Data Source=MYCOMPUTERNAME;Integrated Security=SSPI;Initial Catalog=PTracker;Persist Security Info=False;" providerName="System.Data.SqlClient" />

<add name="Security" connectionString="Data Source=MYCOMPUTERNAME;Integrated Security=SSPI;Initial Catalog=SECURITY;Persist Security Info=False;" providerName="System.Data.SqlClient" />

</connectionStrings>

The above DataSource values assume the system name of your computer is MYCOMPUTERNAME and that you are using the default SqlServer instance.  If you created a custom instance of SqlServer, you will need to append \INSTANCENAME to the computer name.  (Or maybe it is a / instead of a \. )

hth

Jerrychen11 replied on Monday, October 06, 2008

Thanks a lot. Commenting out the CslaDataPortalProxy sorts out the problems.

cheers!
Jerry

Copyright (c) Marimer LLC