Answered by:
Customer Portal 2011 ADX studio 'Specified cast is not valid' error message

Question
-
I keep getting the above error message when running my portal. I have tried deploying it to an IIS website and also running it through vs2010. I know the connections are fine as if i change the portal name in the config, it tells me it cant find the changed name. Background info: I update the dll's to use the latest MS dll (so that the authentication issues in the Xrm.Client dll could be removed). I then had to update all the other dll's too( i.e portal, sdk) and i too regenerated the Xrm dll succesfully to get the latest attributes from my org.
The solution compiles succesfully but when i run it, i get this:
Specified cast is not valid. 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.InvalidCastException: Specified cast is not valid. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidCastException: Specified cast is not valid.] Microsoft.Xrm.Sdk.Entity.GetAttributeValue(String attributeLogicalName) +117 Microsoft.Xrm.Portal.Cms.CrmEntityInactiveInfo.IsInactive(Entity entity) +169 Microsoft.Xrm.Portal.Web.<>c__DisplayClass3.<LookupPageByUrlPath>b__0(Entity entity) +42 System.Linq.<>c__DisplayClassf`1.<CombinePredicates>b__e(TSource x) +21 System.Linq.WhereEnumerableIterator`1.MoveNext() +141 System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +4232308 Microsoft.Xrm.Portal.Web.UrlMapping.LookupPageByUrlPath(OrganizationServiceContext context, Entity website, String urlPath, Func`2 predicate) +499 Microsoft.Xrm.Portal.Web.UrlMapping.LookupPageByUrlPath(OrganizationServiceContext context, Entity website, String urlPath) +270 Microsoft.Xrm.Portal.Web.CrmSiteMapProvider.FindSiteMapNode(String rawUrl) +508 Microsoft.Xrm.Portal.PortalContext.GetNode(RequestContext request) +235 Microsoft.Xrm.Portal.PortalContext.<.ctor>b__2() +43 System.Lazy`1.CreateValue() +361 System.Lazy`1.LazyInitValue() +104 System.Lazy`1.get_Value() +89 Microsoft.Xrm.Portal.PortalContext.get_Entity() +35 Microsoft.Xrm.Portal.Web.Routing.PortalRouteHandler.GetHttpHandler(RequestContext requestContext) +154 System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +9018248 System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +86 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
http://nzcrmguy.blogspot.com/ http://nzspguy.blogspot.com/Monday, October 17, 2011 10:44 PM
Answers
-
When I reverted to the old DLL's, i no longer had any issues. Will email you shortly
http://nzcrmguy.blogspot.com/ http://nzspguy.blogspot.com/- Marked as answer by Palak Kadakia Monday, January 23, 2012 2:46 AM
Tuesday, October 25, 2011 10:59 PM
All replies
-
Hi Bruce,
Have you been able to resolve this issue? Can you give me the exact steps that you have undergone (where you got the dlls and such) and mail me at mariajoa at microsoft so we can go through this together?
Thanks,
Maria
Tuesday, October 25, 2011 8:08 PM -
Hi Maria,
I was not able to resolve this issue. I reverted back to using the older Microsoft dlls and used late binding on the new fields i needed to use. Im not sure what the issue was. I could still email you if you want so you can produce the error?All the dlls I downloaded from the Microsoft sites ,well the actual sdks :)
http://nzcrmguy.blogspot.com/ http://nzspguy.blogspot.com/- Proposed as answer by Palak Kadakia Thursday, November 10, 2011 11:16 PM
Tuesday, October 25, 2011 10:01 PM -
Please do mail me with your steps. So when you used the older Microsoft dlls, did you still encounter any issue?
Thanks,
Maria
Tuesday, October 25, 2011 10:37 PM -
When I reverted to the old DLL's, i no longer had any issues. Will email you shortly
http://nzcrmguy.blogspot.com/ http://nzspguy.blogspot.com/- Marked as answer by Palak Kadakia Monday, January 23, 2012 2:46 AM
Tuesday, October 25, 2011 10:59 PM