Type is not resolved for member, CustomPrincipal, IIS

Type is not resolved for member, CustomPrincipal, IIS

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


fsl posted on Thursday, April 15, 2010

Hi there

I'm using a remote wcf dataportal hosted in IIS7. I'm getting a, "Type is not resolved for member... CustomPrincipal" error. I've read several threads in the forum stating that this should not be an issue with IIS only with the built in development server.. 

Any suggestions on how to fix this?

 

RockfordLhotka replied on Thursday, April 15, 2010

Make sure you are using the same CslaAuthorization config setting on client and server - that will make sure CSLA properly passes the client principal through to the server (or that it won't - depending on the setting).

Do other types flow through the data portal properly? In other words, is this problem unique to the principal object, or does it affect otther objects as well?

fsl replied on Friday, April 16, 2010

Thank for the quick answer.

The problem is unique for CustomPrincipal. The problem went away when i changed the annotation Serializable to DataContract (for the CustomPrincipal class) !

RockfordLhotka replied on Friday, April 16, 2010

Are you still getting correct authorization behaviors on the server? Switching to DataContract probably means the class is coming across, but with no data inside (since to get the data, all the properties or fields would need to be marked with DataMember - and they are not).

tiago replied on Sunday, March 25, 2012

fsl

The problem is unique for CustomPrincipal. The problem went away when i changed the annotation Serializable to DataContract (for the CustomPrincipal class) !

 

This is 100% correct! All you have to do is:

1) add System.Runtime.Serialization to the references

2) add [DataContract] attribute to your custom principal class declaration.

I'm using Csla 4.3.10 with VS2010 (and not using IIS Express)

RockfordLhotka replied on Sunday, March 25, 2012

The problem is typically unique to the dev web server. Using datacontract instead of serializable will generally cause all sorts of problems for business objects, so be careful!!!

To do it right, you must mark all fields with datamember, including any in the base class and any referenced objects. Also you must use the config setting to force CSLA to always use the NDCS, and you can't then use SL, WP7, or WinRT...

 

tiago replied on Sunday, March 25, 2012

RockfordLhotka

The problem is typically unique to the dev web server.

I guess you are rigth. I was using Visual Studio Development Server and changed to IIS Express. No need for DataContract after all.

Copyright (c) Marimer LLC