Why Doesn't Lhotka's Code Break here?

Why Doesn't Lhotka's Code Break here?

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


SimpleCSLA posted on Thursday, May 24, 2007

How do you know if this is working right?
Public Class EnterpriseServicesProxy
  Inherits Csla.DataPortalClient.EnterpriseServicesProxy

  Protected Overrides Function GetServerObject() As _
    Csla.Server.Hosts.EnterpriseServicesPortal

    Return New EnterpriseServicesPortal

  End Function

End Class


When the EnterpriseServicesPortal is returned, how do you know if it got anything?  For example, this code runs fine if I have EnterpriseServicesPortal COM+ running, or even if I delete it from COM+ services.

RockfordLhotka replied on Thursday, May 24, 2007

Try removing it from COM+ and then running your app as a non-Admin user, and I bet it fails.

.NET auto-installs components into COM+ for you. Of course that only works if you are an Admin, so it isn't real reliable.

Another way to watch it fail is to use the ES proxy from ASP.NET. There too, the user isn't an Admin and so the auto-reg fails.

Really you don't want to use auto-reg here in any case, because it won't do the right thing. You need to do the steps in Chapter 12 to make it work properly.

SimpleCSLA replied on Thursday, May 24, 2007

 I'm actually trying to use Chapter 4 and ignore Chapter 12 for now.  I just want to get the Project Tracker to run.  Can you tell me the page in Chapter 4 which allows me to run locally?  I see the section on CSLA.DataPortalClient.LocalProxy, but how do I force the Project Tracker to use the LocalProxy and not go through Remoting or Web Services.

I'm assuming if I run locally I don't need EnterpriseServicesVB.DLL.

SimpleCSLA replied on Thursday, May 24, 2007

 This is the mInnerStackTrace (if it helps):
"   at ProjectTracker.Library.Database.get_SecurityConnection() in C:\CSLA_214\csla20vb\ProjectTracker20vb\ProjectTracker.Library\Database.vb:line 13
   at ProjectTracker.Library.Security.PTIdentity.DataPortal_Fetch(Criteria criteria) in C:\CSLA_214\csla20vb\ProjectTracker20vb\ProjectTracker.Library\Security\PTIdentity.vb:line 110
   at Csla.MethodCaller.CallMethod(Object obj, MethodInfo info, Object[] parameters) in C:\CSLA_214\csla20vb\csla20vb\Csla\DataPortal\MethodCaller.vb:line 123
   at Csla.Server.SimpleDataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context) in C:\CSLA_214\csla20vb\csla20vb\Csla\DataPortal\Server\SimpleDataPortal.vb:line 116"


RockfordLhotka replied on Thursday, May 24, 2007

If you just want to get ProjectTracker running, follow the instructions in the PDF available from www.lhotka.net/cslanet/download.aspx.

If you want to understand how to configure the data portal for various configurations use Chapter 12.

If you want to understand how to design and implement the data portal, use Chapter 4.

You are correct - if you use the local proxy you don't need Enterprise Services. For PTWin this is trivial - just comment out all the data portal config lines in the <appSettings> element.

For PTWeb this is harder, because in local mode ASP.NET won't let you get at the database files, so you need to copy the mdf files into app_data and change the connection strings.

SimpleCSLA replied on Thursday, May 24, 2007

 I think I'm almost there.  I don't see an 'app_data' directory.  Does this need to be created directly in the PTWeb folder and do I need to give ASP.NET special permission to access it?

Thanks.     

RockfordLhotka replied on Thursday, May 24, 2007

The App_Data directory needs to be added to your project, yes. Use of this folder is standard for ASP.NET apps, and any ASP.NET book or article should help you get it created and configured properly.

 

(unfortunately all my web sites use a real SQL Server instance, so I don’t know how or if you can use a SQL Express db in this case… In fact, now that I think about it, I may be sending you on a wild goose chase, because it may be that SQL Express won’t work behind ASP.NET?)

 

Rocky

 

 

From: SimpleCSLA [mailto:cslanet@lhotka.net]
Sent: Thursday, May 24, 2007 10:10 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Why Doesn't Lhotka's Code Break here?

 

 I think I'm almost there.  I don't see an 'app_data' directory.  Does this need to be created directly in the PTWeb folder and do I need to give ASP.NET special permission to access it?

Thanks.     


SimpleCSLA replied on Thursday, May 24, 2007

You may be right.  I got a SQL 2005 database to run that used the scripts you provided in the download.

Now that I have the database running locally, I can mess around with the framework and later tackle remoting.

Thanks for the help!     

ajj3085 replied on Thursday, May 24, 2007

RockfordLhotka:
(unfortunately all my web sites use a real SQL Server instance, so I don’t know how or if you can use a SQL Express db in this case… In fact, now that I think about it, I may be sending you on a wild goose chase, because it may be that SQL Express won’t work behind ASP.NET?)


IIRC, App_Data exists pretty much for you to store your Sql Express database, to be attached on demand.  According to my Pro asp.net 2.0 in C# 2005 book (also from apress).

On a side note, I've been very happy with the books I've gotten from apress so far..

Copyright (c) Marimer LLC