Unable to find a Website with the Name =="Customer Portal"

May 11, 2010 at 6:18 PM
Edited May 11, 2010 at 6:18 PM

I've gone through the installation document and got to set 12.

I changed the web config appropriately and created a website on port 81 called "Customer Portal". However I'm getting the following error:

Server Error in '/Customer-Portal-R2_deploy' Application.
--------------------------------------------------------------------------------

Unable to find a Website with the Name == "Customer Portal"
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.ApplicationException: Unable to find a Website with the Name == "Customer Portal"

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:


[ApplicationException: Unable to find a Website with the Name == "Customer Portal"]
   Microsoft.Xrm.Portal.Cms.WebsiteSelectors.NameWebsiteSelector.GetWebsite() +339
   Microsoft.Xrm.Portal.Web.SiteContextModule.IsPageTemplatePath(String path) +148
   Microsoft.Xrm.Portal.Web.SiteContextModule.RewritePath(Object sender, EventArgs args) +1262
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +182
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +266

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

May 12, 2010 at 7:52 AM

Hi.

Did you use the "websitecopy.exe" tool with the customerportal.xml config file as described in the installation guide?

I got the same error when i just made a website with the portal sampel pages and ajusted the webconfig file.

regards

Jacob Mondrup

 

May 12, 2010 at 9:30 AM

Since the websitecopy tool doesn’t work for me either, I have created the portal by copy the pages manually. But I get the same error, probably due to the missing sites in the CMS in CRM. All these records are created by the websitecopy tool.

Any other way of getting all these records and internal relation created?

regards

Jacob Mondrup

May 12, 2010 at 12:24 PM

Hi,

I am also having trouble using the website copy tool. I'm trying to test the new version of the portal by adding it to the CRM demo VPN for contoso.

I have followed the steps to install the customizations first and checked that they are installed correctly. I've tried a mix of parameters, running the tool with an existing 'customerportal.xml' website in IIS, running it without it existing, IIS resets.

The error makes me assume that somewhere in the source.xml there is an error.

Has anyone actually installed this xml file successfully? I wish we had the source for this tool so we could debug it ourselves.

Command

websitecopy.exe /targetconnectionstring:"AuthenticationType=Integrated; server=http://crm/contoso" /targetwebsitename:"Customer Portal" /sourcefile:"c:\temp\customerportal.xml"

Error

 Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at WebsiteCopy.Copier.Copy(String[] args)
   at WebsiteCopy.Program.Main(String[] args)

May 12, 2010 at 12:33 PM
Edited May 12, 2010 at 1:19 PM

Hi JDZ,

I "think" (because i can't find any documentation) that authentication type has to be either SPLA or Password - but if there is more documentation out there a link would be appriciated.

 

UPDATE: if you use AD as authentication Type remember to use type userid like domain\username

May 12, 2010 at 12:57 PM

Hi Mortengad,

I found the connection types here

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

I have also tried AD authentication and I get a slightly different error now which is below.

I also tried modifying the XML file as I found it contained GUID's of business units & user ID's that do not exist in my deployment.

New Command

websitecopy.exe /targetconnectionstring:"Authentication Type=AD; Server=http://crm/contoso; Password=pass@word1;  User ID=administrator;" /targetwebsitename:"Customer Portal" /sourcefile:"customerportalorig.xml"

New Error Message

Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Microsoft.Xrm.Client.CrmConnection.GetCrmConnectionDetails(String reason)
   at Microsoft.Xrm.Client.CrmConnection.<>c__DisplayClass2.<.ctor>b__0(String load)
   at Microsoft.Xrm.Client.Threading.MutexExtensions.<>c__DisplayClass2`1.<Get>b__0(Mutex _)
   at Microsoft.Xrm.Client.Threading.MutexExtensions.Lock(String key, Int32 millisecondsTimeout, Action`1 action)
   at Microsoft.Xrm.Client.Threading.MutexExtensions.Get[T](String key, Int32 millisecondsTimeout, Func`2 loadFromCache, Func`2 loadFromService)
   at Microsoft.Xrm.Client.Threading.MutexExtensions.Get[T](String key, Func`2 loadFromCache, Func`2 loadFromService)
   at Microsoft.Xrm.Client.Caching.Cache.Get[T](String label, Func`2 load, Action`1 insert)
   at Microsoft.Xrm.Client.CrmConnection..ctor(String connectionStringName, String connectionString)
   at WebsiteCopy.WebsiteImporter.Import(XElement element, String websiteName)
   at WebsiteCopy.WebsiteImporter.Import(Stream input, String websiteName)
   at WebsiteCopy.WebsiteImporter.Import(String inputXml, String websiteName)
   at WebsiteCopy.Copier.Copy(String[] args)
   at WebsiteCopy.Program.Main(String[] args)

May 12, 2010 at 1:03 PM

Hi,

This connection string worked for me for On-Premise .Authentication Type change accordingly to SPLA or PASSPORT for other deployments.


>websitecopy.exe /targetConnectionString:"Authentication Type=AD; Server = http://localhost:5555/accelerators; User ID=<domainname\username>; Password=<password>;" /targetWebsiteName:"Customer Portal" /sourceFile:C:\customerportal.xml

 

crm40

May 12, 2010 at 1:04 PM

That should be the case, but if you use anything but SPLA or Password the error you describes appears. So it was my assumption that only SPLA and Password was allowed ( and the fact that these methods are the only ones described in the documentation).

 But if you succeed I would like to hear about it…

May 12, 2010 at 1:16 PM

With AD authentication & adding the domain to the username I got it working...

websitecopy.exe /targetconnectionstring:"Authentication Type=AD;Server=http://crm/contoso; Password=pass@word1;  User ID=contoso\administrator;" /targetwebsitename:"Customer Portal" /sourcefile:"customerportal.xml"

Thanks crm40 & mortengad!

JdZ

May 12, 2010 at 1:17 PM

and for me :)

May 12, 2010 at 1:39 PM

That syntax worked for me aswell, and the portal is now running nicely.

Now i'm strungeling with the LIVE ID authentication. :-)

Regards

Jacob Mondrup

May 12, 2010 at 6:42 PM

I'm still having troubles myself.  Trying to use AD authentication, but I get either the IndexOutofRange error, or Unauthorized user.  I've tried 2 different accounts I have in CRM (Administrator and my account), but still get it.  Even using the domain in the User ID

also tried various methods of calling the server, such as http://localhost:5555, http://servername:5555, both which work on that server to access CRM.  I have also tried from my local machine using the public domain, and get same thing.  For reference, this is a CRM for a customer that is hosting in our data center with IFD.

websitecopy /targetConnectionString:"Authentication Type=AD; Server=http://localhost:5555; User ID=mydomain\Administrator; Password=thepassword;" /targetWebsiteName:"Customer Portal" /sourcefile:customerportal.xml

 

May 12, 2010 at 6:46 PM
Shouldn you ude the URL syntax http://server/orgname ? Regards jacob mondrup
May 12, 2010 at 6:50 PM

Jacob, did you solve the Live Authentication issue?

May 12, 2010 at 7:02 PM
jacobmondrup wrote:
Shouldn you ude the URL syntax http://server/orgname ? Regards jacob mondrup

 *duh*  BUSTED!

changed it to http://localhost:5555/orgname, and it worked...  Awesome!  Thanks :)

May 12, 2010 at 9:53 PM

Got the Live Authentication working now - seems like a problem with the documentation (or the way I read it) but the return URL is domain/live.axd - that url don't get you anywhere - a quick look in the web.config file got me on the right track again - under <httphandlers> look for the LiveID.axd line and change that to live.axd.

That did it for me.

May 14, 2010 at 8:53 AM
Edited May 14, 2010 at 8:54 AM

Hi.

Still doesn’t work for me. I have adjusted the "LiveID.axd" to places in the webconfig file and in the service component return URL.

BUT: As I can see, there is no such file as "Live.axd" or "LiveID.axd" for that matter. Shouldn't the file be in the portal web folder on the server?

At the same time I have some problems regarding creating the invitation. I assume that an invitation is necessary before you can login?

When I run the invitation workflow, the workflows status is completed, but no e-mail activity is created on the contact. When I try to use the "create invitation" button on the contacts form, I can see an "An error on the page....." in the left lower cloner on the browser window.

Any ideers?

Regards, Jacob Mondrup

May 14, 2010 at 9:19 AM

Well: I got it working: Some configurations on the contact entity were not imported properly. I imported the customization file again for the contact entity, and then it worked.

May 14, 2010 at 10:15 AM

New problems, but I'm getting there:

The portal is now working. But when creating cases, and scheduling of service request, an error appears:

E.g. "Sequence contains no matching element" (when creating a case)

Especially line likes this, make me think that further needs to be manually adjusted:

"Site.Pages.eService.CreateCase.CreateButton_Click(Object sender, EventArgs e) in C:\R5 Builds\Security Testing\Customer-Portal-RZ\Website\Pages\eService\CreateCase.aspx.cs:40"

This path is not a path on my server. Could it be some leftovers from de developers?

Does anybody know how to resolve?

Regards, Jacob Mondrup

May 14, 2010 at 10:19 AM

I don't think you should mind the path in the error - thats very common...

Did you create a service with *WEB* in the description - i think i had that exact same error but the "web enabled" service resolved that.

May 14, 2010 at 10:28 AM

I can create a case from the CRM, and get it displayed on the web amd I can add a new note from the web. I can control if the notes are displayed on the web with the *web* tag.

The problem is when I create a case from the web. Then this apears:

 

Server Error in '/' Application.

Sequence contains no matching element

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.InvalidOperationException: Sequence contains no matching element

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:

[InvalidOperationException: Sequence contains no matching element]
   System.Linq.Enumerable.First(IEnumerable`1 source, Func`2 predicate) +731197
   Site.Pages.eService.CreateCase.CreateButton_Click(Object sender, EventArgs e) in C:\R5 Builds\Security Testing\Customer-Portal-R2\Website\Pages\eService\CreateCase.aspx.cs:40
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565



Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016

<!-- [InvalidOperationException]: Sequence contains no matching element at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate) at Site.Pages.eService.CreateCase.CreateButton_Click(Object sender, EventArgs e) in C:\R5 Builds\Security Testing\Customer-Portal-R2\Website\Pages\eService\CreateCase.aspx.cs:line 40 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.pages_eservice_createcase_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->
May 14, 2010 at 12:15 PM

Problem solved:

When running the CRM in non-English, you have to adjust the settings for "case/subject" and "case/prioritycode" to match the local language labels.

regards, Jacob Mondrup

May 14, 2010 at 7:25 PM

There are WAY too many issues in this thread.  I will try to respond to all the problems in this message, but it would be nice if each of these were in a separate thread.  Hopefully the readers can get through this long thread.

WebsiteCopy issues:

ianceicys, jacobmondrup, jdz_munich
I have validated that the websitecopy utility works with Integrated security.  There is no need to use Authentication Type=AD unless you want to provide alternate credentials than the user you are currently logged in with.  I looked at your connection string and it appears to be correct.  I suspect that the problem is that your CRM schema has not been imported yet, so when the utility is trying to add the content, it is throwing an error.  I will see about adding a schema test and an appropriate error message for future versions.

mortengad
All CRM deployments are supported - on-prem, partner-hosted, online.

Live ID Issues:
The web.config does use LiveId.axd as the application handler.  The instructions have you register live.axd.  It doesn't matter which you use, but they have to be the same.  I personally leave the web.config using LiveId.axd, but I also use the same url when I register my application in live services.

jacobmondrup
The Live ID authentication handler is a handler that is in the portal framework, not one that is in the website.  The appropriate way to hook it up is to add it to the httphandlers section in the web.config.

Invitation Issues:
Yes, the default model is that an invitation is required to use the portal.  This is accomplished by setting a security question and answer on the contact record, then hitting the generate invitation key icon on the toolbar, which seeds a random invitation key and sets an expiry date.  You then have to save the contact record, then kick off the invitation workflow.  The invitation workflow will not send an email unless there is an invitation code as well as a password question and answer, which probably explains why you did not see the email being sent.  I understand that the customer on-boarding experience is somewhat complex, but it was decided early on in the project to ship the samples secure instead of shipping them simple.  The good news is that you can adjust the site code and implement your own on-boarding mechanism - the framework won't limit you.

code error on CreateCase.aspx.cs:
Yes, this is a left-over from the development environment.  Simply open your website in Visual Studio and recompile it.  You can also debug it from there as well.  I believe you found the problem - the content in the CRM that was imported is for an English installation, and yes, adjusting it to match your local labels is the solution.

Shan McArthur
www.shanmcarthur.net

Apr 11, 2012 at 2:34 PM

well, i have had the same issue, or similar:

Sequence contains more than one element

[InvalidOperationException: Sequence contains more than one element] Microsoft.Xrm.Sdk.Linq.QueryProvider.ThrowException(Exception exception) +12 Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups, String& pagingCookie, Boolean& moreRecords) +583 Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups) +131 Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(Expression expression) +216 Microsoft.Xrm.Sdk.Linq.QueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +85 System.Linq.Queryable.SingleOrDefault(IQueryable`1 source, Expression`1 predicate) +590 Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.FindContactByInvitationCode(HttpContext context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext, OrganizationServiceContext serviceContext, String invitationCode, String optionalChallengeAnswer) +2681 Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.FindContactByInvitationCodeAndChallengeAnswer(HttpContext context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext, OrganizationServiceContext serviceContext, String invitationCode, String challengeAnswer) +265 Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryRegisterNewContact(HttpContext context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext, OrganizationServiceContext serviceContext, SessionSecurityToken sessionSecurityToken, String identityProvider, String userName, String email, String displayName) +1196 Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryHandleSignInResponse(HttpContext context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext) +951 Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryHandleSignInResponse(HttpContext context, WSFederationAuthenticationModule fam) +120 Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.ProcessRequest(HttpContext context) +530 [FederationAuthenticationException: Federated sign-in error.] Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.ProcessRequest(HttpContext context) +1204 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +625 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270

 

finallly we realized that the problem(at least for us) was that we were using the same activation code for 2 different members(crm users), so the Customer Portal authtentication process was getting several results when it was trying to do a Linq.SingleorDefault... This method is supposed to return only one element, and the internal query was returning more than one. We figured out where was the problem but was painful.

 

i hope this help u,

cheers,

Israel.