Hi,
I have download the ProjectTracker code from CSLA site.
Then I run the application and I clicked on "Log on" link...then internally happens the following:
1) PTPrincipal.Login(....)
2) Then, enter to UserDal's Fetch(..) method
3) Then enter to Membership.ValidateUser(...) method (this will go to CustomMembershipProvider implementation)
4) Then enter again to PTPrincipal.Login(....)
5) Then This cause a System.StackOverflowException
What are happening?...Is this a bug or I must implement some thing to run correctly the application?..
What version are you using? 4.x?
I don't believe the 3.8 version worked, but I run the 4.3 version all the time, so I'm pretty confident that it is correct.
Sorry to resurrect this old thread, but I'm seeing the same behavior. I've downloaded the most recent 4.5.x version of the ProjectTracker application and when I run the MVC3 version using the EF DAL it loops onto itself.
For example:
The AccountController LogOn method calls MembershipService.ValidateUser
MembershipService.ValidateUser calls PTPrincipal.Login
PTPrincipal.Login calls PTIdentity.GetPTIdentity
PTIdentity.GetPTIdentity calls DataPortal_Fetch
DataPortal_Fetch calls ProjectTracker.DalEf.Fetch(username, password)
ProjectTracker.DalEf.Fetch(username, password) calls MembershipService.ValidateUser again...
This cycle continues until the Stack overflows.
Thanks!
-G
It sounds like the MVC project has been configured to run the data portal in local mode. The data portal _should_ be calling from the web server to the app server (the WcfAppServer project) based on the web server's web.config file:
<appSettings> <add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla"/> <add key="CslaDataPortalUrl" value="http://localhost:22627/WcfPortal.svc"/>
Thus the second call to the membership service occurs on the app server, where it will interact with the actual ASP.NET membership database.
You are exactly right. I am trying to run the data portal local mode. Shouldn't I be able to do that without modifying the code by changing the configuration?
Thank you for your help,
-G
Obviously with the implementation of this particular sample it does matter that the server-side code run on a different machine from the web server :)
It is because of the custom membership provider that uses PTIDentity and the PTIdentity uses the membership provider for login again.
This creates a recursive call when used in local mode.
In order to run in local mode you must add connection string and membership provider configuration and lastly add both databases to APP_DATA folder in the MVC3 project.
<connectionStrings> <add name="PTrackerEntities" connectionString="metadata=res://*/PTracker.csdl|res://*/PTracker.ssdl|res://*/PTracker.msl;provider=System.Data.SqlClient;provider connection string='Data Source=(LocalDB)\v11.0;attachdbfilename=|DataDirectory|PTracker.mdf;integrated security=True;multipleactiveresultsets=True;App=EntityFramework'" providerName="System.Data.EntityClient" /> <add name="ApplicationServices" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|aspnetdb.mdf;Integrated Security=True;Connect Timeout=30" providerName="System.Data.SqlClient" /> </connectionStrings>
and
<!--- UNCOMMENT TO USE STANDARD MEBERSHIP PROVIDER FOR AUTHENTICATION WITH LOCAL PORTAL --> <membership userIsOnlineTimeWindow="15"> <providers> <clear /> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> </providers> </membership> <roleManager enabled="true" cacheRolesInCookie="false"> <providers> <clear /> <add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" /> </providers> </roleManager> <!-- UNCOMMENT END--> <!--- UNCOMMENT TO USE PTIdentity FOR AUTHENTICATION ON REMOTE PORTAL --> <!--<authorization> <deny users="?"/> <allow users="*"/> </authorization>--> <!--<membership defaultProvider="CustomMembershipProvider"> <providers> <add name="CustomMembershipProvider" type="Mvc3UI.CustomMembershipProvider,Mvc3UI" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" description="Retrieves membership data using CSLA .NET business objects."/> </providers> </membership>--> <!-- UNCOMMENT END-->
Copyright (c) Marimer LLC