web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Beginers help needed trying to create a portal

(0) ShareShare
ReportReport
Posted on by 1,703

I have been following a post on how to set up a basic portal, but I keep running into problems. This is a learning curve for me, more or a practice run as a learning tool. I am simply trying to connect to CRM to the Accounts entity but keep getting. Please bear in mind that at the moment I am just looking to connect to Account entity without errors, before I investigate displaying data, hence my form has no fields. The project loads fine, but I get the error when calling the Administration.aspx page.  

Server Error in '/' Application.


The value 'Xrm.XrmServiceContext, CBICustomerPortal' is not recognized as a valid type or is not of the type 'Microsoft.Xrm.Sdk.Client.OrganizationServiceContext'.

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.Configuration.ConfigurationErrorsException: The value 'Xrm.XrmServiceContext, CBICustomerPortal' is not recognized as a valid type or is not of the type 'Microsoft.Xrm.Sdk.Client.OrganizationServiceContext'.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.


Stack Trace:

[ConfigurationErrorsException: The value 'Xrm.XrmServiceContext, CBICustomerPortal' is not recognized as a valid type or is not of the type 'Microsoft.Xrm.Sdk.Client.OrganizationServiceContext'.]
   Microsoft.Xrm.Client.Configuration.InitializableConfigurationElement`1.GetDependencyType() +248
   Microsoft.Xrm.Client.Configuration.OrganizationServiceContextElement.CreateOrganizationServiceContext(IOrganizationService service) +95
   Microsoft.Xrm.Client.Configuration.CrmConfigurationProvider.CreateContext(String contextName, Boolean allowDefaultFallback) +85
   Microsoft.Xrm.Client.Configuration.CrmConfigurationManager.CreateContext(String contextName, Boolean allowDefaultFallback) +55
   Microsoft.Xrm.Portal.OrganizationServiceContextFactory.Create(String name) +7
   Microsoft.Xrm.Portal.Web.UI.WebControls.CrmDataSourceView..ctor(CrmDataSource owner, String name, HttpContext context) +64
   Microsoft.Xrm.Portal.Web.UI.WebControls.CrmDataSource.GetView() +51
   Microsoft.Xrm.Portal.Web.UI.WebControls.CrmDataSource.TrackViewState() +20
   System.Web.UI.Control.InitRecursive(Control namingContainer) +159
   System.Web.UI.Control.InitRecursive(Control namingContainer) +318
   System.Web.UI.Control.InitRecursive(Control namingContainer) +318
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6746
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +250
   System.Web.UI.Page.ProcessRequest() +76
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +24
   System.Web.UI.Page.ProcessRequest(HttpContext context) +62
   ASP.administration_aspx.ProcessRequest(HttpContext context) +48
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +195
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +73
<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  go.microsoft.com/.../
  -->
<configuration>
 
  <configSections>
    <section name="microsoft.xrm.client" type="Microsoft.Xrm.Client.Configuration.CrmSection,Microsoft.Xrm.Client"/>
  </configSections>
  <connectionStrings>
    <add name="WebFormDataSource" connectionString="Url=https://xxx.xxxxx.xx.xx:444; Username=administrator@xxxxxx; Password=xxxxxxxx"/>
  </connectionStrings>
 
  <microsoft.xrm.client>
    <contexts>
      <add name="WebFormDataSource" type="Xrm.XrmServiceContext, CBICustomerPortal" />
    </contexts>
  </microsoft.xrm.client>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.6.1"/>
    <httpRuntime targetFramework="4.6.1"/>
    <pages>
      <namespaces>
        <add namespace="System.Web.Optimization"/>
      </namespaces>
      <controls>
        <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/>
        <add tagPrefix="crm" namespace="Microsoft.Xrm.Portal.Web.UI.WebControls" assembly="Microsoft.Xrm.Portal" />
      </controls>
    </pages>
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f"/>
        <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"/>
        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
      </dependentAssembly> 
    </assemblyBinding>
  </runtime>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>
</configuration>
aspx page
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Administration.aspx.vb" Inherits="CBICustomerPortal.Administration" %>
<!DOCTYPE html>
<html xmlns="">www.w3.org/.../xhtml">
<head runat="server">
    <title>Administration</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <crm:CrmDataSource ID="WebFormDataSource" runat="server"  />
            <crm:CrmEntityFormView runat="server" DataSourceID="WebFormDataSource" ID="Administration" EntityName="Account" SavedQueryName="Active Accounts" ValidationGroup="validators" ></crm:CrmEntityFormView>
        </div>
    </form>
</body>
</html>
Imports Microsoft.Xrm.Client
Imports Microsoft.Xrm.Client.Services
Imports Microsoft.Xrm.Portal.Web.UI.WebControls
Public Class Administration
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
End Class
If anyone can point out where I am going wrong on what seems to be a simple exercise, I might actually learn something 
I have the same question (0)
  • Pete_N Profile Picture
    1,703 on at
    RE: Beginers help needed trying to create a portal

    Hi Omar

    Thank you for your feedback. Unfortunately with the nature of our business we would prefer to keep to on premises. The whole point of this exercise  was to establish and test if it was possible to reduce the amount of SQL databases we currently use, and do away with data-sync by having a customer  application / portal that deals direct with our CRM. We don't use our CRM in the conventional way, more use its inbuild structure as a building block for custom entities.  Although I don't want to elaborate too much, but our business is a bespoke business within the financial sector. The current aging web app we currently have is is dire need of replacing and it make sense to try and interface directly with the CRM.

    I have taken your comments on board and will investigate The Portal Connector, though trying to sell it to the board may be a tougher task than trying to get my 'test project to work'

  • Community Member Profile Picture
    on at
    RE: Beginers help needed trying to create a portal

    Hi Pete,

    If you want my opinion, this is not the way to go. The reason is using this portal to understand what you can do (later) with the Microsoft provided portal will give you a lot of false information. Many of the things you will be able to do now, you won't be able to do later and visa versa. So, instead of helping you decide, it will actually make your life harder in the future.

    Also, the support for this portal is dead as of last year or so, you will be on your own tacking all the problems faced.

    Do you have "any" plans to move to Dynamics online instead of on-prem? If no, then you may need to look at another supported portal but one that doesn't look for Microsoft, such as www.crmportalconnector.com/. This one has support behind it and you can customize their code as well.

    Sorry if I look like pushing the on-prem adx portal away, but in my opinion, using it will cause more troubles than benefits along the line.

  • Pete_N Profile Picture
    1,703 on at
    RE: Beginers help needed trying to create a portal

    Hi Omar,

    There are a few reasons, the main one being my lack of knowledge. We are running an on premises CRM and I am looking to see if we are able to integrate our existing customer WebApp into it rather than have the pain of data sync between the webApp SQL and CRM  I am not sure if we are able to accomplish this task, as the customers upload files of banking transactions etc. I'm hesitant to look at a hosted OOB Portal until I get a better understanding of exactly what we would be able to.    

  • Community Member Profile Picture
    on at
    RE: Beginers help needed trying to create a portal

    Hi Pete,

    What you are doing (using the old ADX portal) is fine but it is not recommended. May I ask why are you using it? if you have a valid reason, then we can debug you code further, if not, use the OOB Portal add-on that gives you a hosted portal that you can configure and has much less problems than this.

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
DAnny3211 Profile Picture

DAnny3211 134

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 132

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans