locked
Could not load type 'Xrm.XrmServiceContext'. RRS feed

  • Question

  • Hi,

    I followed this example:

    http://msdn.microsoft.com/en-us/library/gg695790.aspx

    but when start my web page i received this error: Could not load type 'Xrm.XrmServiceContext'.

    Stack Trace: 
    
    
    [HttpException (0x80004005): Could not load type 'Xrm.XrmServiceContext'.]
       System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +8940107
       System.Web.UI.WebControls.LinqDataSourceView.get_ContextType() +107
    
    [InvalidOperationException: Could not find the type specified in the ContextTypeName property of LinqDataSource 'Contacts'.]
       System.Web.UI.WebControls.LinqDataSourceView.get_ContextType() +232
       System.Web.UI.WebControls.LinqDataSourceView.CreateContextAndTable(DataSourceOperation operation) +820
       System.Web.UI.WebControls.LinqDataSourceView.CreateContextAndTableForSelect() +118
       System.Web.UI.WebControls.LinqDataSourceView.CreateContext(DataSourceOperation operation) +12
       System.Web.UI.WebControls.ContextDataSourceView.GetSource(QueryContext context) +20
       System.Web.UI.WebControls.LinqDataSourceView.GetSource(QueryContext context) +330
       System.Web.UI.WebControls.LinqDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +69
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
       System.Web.UI.WebControls.GridView.DataBind() +4
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
       System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
       System.Web.UI.Control.EnsureChildControls() +102
       System.Web.UI.Control.PreRenderRecursiveInternal() +42
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
    
     
    

    Help me

    Wednesday, January 4, 2012 9:02 AM

Answers

  • Thanks  Scott,

    I realized my mistake. I had to insert xrm.cs file into the App_Code folder.

    • Marked as answer by foffolo Wednesday, January 4, 2012 10:18 AM
    Wednesday, January 4, 2012 9:59 AM

All replies

  • Hi foffolo,

    It looks like:

    1. You might have missed the namespace and/or serviceContextName parameters off your CrmSvcUtil call

    or

    2. You haven't completed step 4:

    1. Right-click the project in Visual Studio, click Add, and then click Existing Item.

    2. Select the “xrm.cs” file that you created when you generated the early bound types.

    Scott


    www.develop1.net
    Wednesday, January 4, 2012 9:14 AM
    Answerer
  • Thanks  Scott,

    I realized my mistake. I had to insert xrm.cs file into the App_Code folder.

    • Marked as answer by foffolo Wednesday, January 4, 2012 10:18 AM
    Wednesday, January 4, 2012 9:59 AM
  • hi is it resolved or not?

    By Sanz If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Wednesday, January 4, 2012 10:04 AM
  • It is resolved
    • Proposed as answer by lvm71 Wednesday, March 28, 2012 10:57 AM
    Wednesday, January 4, 2012 10:18 AM
  • Didn't work for me. Actually caused more errors.
    • Proposed as answer by LeSteelBox Wednesday, September 4, 2013 4:07 PM
    • Unproposed as answer by LeSteelBox Wednesday, September 4, 2013 4:07 PM
    • Proposed as answer by LeSteelBox Wednesday, September 4, 2013 4:15 PM
    • Unproposed as answer by LeSteelBox Wednesday, September 4, 2013 4:16 PM
    Tuesday, September 3, 2013 9:26 PM