Setup And Getting Started Forum


Error for the first time run CMS

 
Pls help me to solve this error:
There is already an open DataReader associated with this Command which must be closed first.
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: There is already an open DataReader associated with this Command which must be closed first.
Source Error:
Line 46:                 string url = HttpContext.Current.Request.Url.Authority.ToLower();
Line 47:                 IEnumerable<Portal> portals = _inmemorycacheService.Get(PortalsHolder, () => _portalRepository.ListPortals());
Line 48:                 return portals.Where(portal => portal.URLAuthority.Equals(url)).FirstOrDefault();
Line 49:             }
Line 50: 
Source File: C:\Users\xxx\Desktop\MvcCms\MvcCms.Core\Cache\CacheService.cs    Line: 48



2 years 2 months 20 days ago by phuonglewis

Replies

Reply posted by jon 2 years 2 months 20 days ago View Branch And Reply
I haven't seen that error in a while but I would say that the url you are using isn't matching up with the portal url setting. Are you running from IIS or Visual Studio? Recheck the URLAuthority value you have that is matching up with either IIS or Visual Studio, and reset the web.
 
If that doesn't work post your values from your portals table and give me the url of the page showing the error.
Reply posted by phuonglewis 2 years 2 months 19 days ago View Branch And Reply
I'm running it from Visual Studio 2008. B/c I'm new with it so I don't know what the url you mentioned is about. Pls tell me how to check it?
Reply posted by jon 2 years 2 months 19 days ago View Branch And Reply
I am betting then that you may not have the database setup in sql server express yet. Can you check that the database is setup in sql server express. You can do this in Visual Studio in the server explorer.
Reply posted by phuonglewis 2 years 2 months 19 days ago View Branch And Reply
Yeah, I don't use the Sql Server Express, I use Sql Server Developer Edition. I've setup the db in Sql Server Management Studio and then copy the connection string into web.config. Here is my connection string:

Data Source=.;Initial Catalog=MvcCms;Persist Security Info=True;User ID=sa;Password=*********


Reply posted by jon 2 years 2 months 19 days ago View Branch And Reply
OK, what are the results in sql when you run the following
 
select URLAuthority from Portals
 
Then also what is the url in the browser when you get the error message you posted. I am just ensuring that the portal match by url is taking place. Often when there is an error in the area of the one you are having it is because no portal url is matching.
  1 2 3 4