Can not set up the CMS to use Sql Server Database

Jul 24, 2010 at 1:27 PM

Hello everyone

 

I found that ASP.NET MVC CMS ( Using CommonLibrary.NET ) is best asp.net that I ever seen. It ‘s simple and full function.

It’s run perfectly with in-memory. However when I follow this instruction.

Setup - ( Sql Database )

   1. Do steps 1 - 2 in "quick setup" above ( download source & open solution file ).

   2. Run sql schema install file at <ROOT>\install\_install_models_all.sql ( app will auto create sample data ).

   3. Run sql schema install file at <ROOT>\install\_install_model_user.sql ( app will auto create sample users ).

   4. In Global.asax, in method "Configure()" change flag useRealData from false to true. e.g. bool useRealData = true;

   5. Change db connection in <ROOT>\config\dev.config ( Database: connectstr )

   6. Run the app in studio

For the point 3 there is no \_install_model_user.sql with simple data.

sql file in point 2 execute successfully and get over 30 row of user

this instructor is stored in download source code package form codeplex

However, this application fails and has some errors as following.  

Server Error in '/' Application.

The partial view '~/views/shared/Widgets/Gravatar.ascx' was not found. The following locations were searched:
~/views/shared/Widgets/Gravatar.ascx

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: The partial view '~/views/shared/Widgets/Gravatar.ascx' was not found. The following locations were searched:
~/views/shared/Widgets/Gravatar.ascx

Source Error:

Line 21:            path = "~/views/shared/" + path + ".ascx";
Line 22: %>
Line 23: <div class="wbody"> <% Html.RenderPartial(path, Model); %></div><br /><br />
Line 24: <% } %>
Line 25: </div>


Source File: e:\CommonLibraryCMS_0.9.4.5_BETA_1_Sources\src\apps\CommonLibrary.CMS\Views\Shared\Controls\Widget.ascx    Line: 23

Stack Trace:

[InvalidOperationException: The partial view '~/views/shared/Widgets/Gravatar.ascx' was not found. The following locations were searched:
~/views/shared/Widgets/Gravatar.ascx]
System.Web.Mvc.HtmlHelper.FindPartialView(ViewContext viewContext, String partialViewName, ViewEngineCollection viewEngineCollection) +427
System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +425
System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper htmlHelper, String partialViewName, Object model) +117
ASP.views_shared_controls_widget_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in e:\CommonLibraryCMS_0.9.4.5_BETA_1_Sources\src\apps\CommonLibrary.CMS\Views\Shared\Controls\Widget.ascx:23
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +56
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060



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

 

Please could you help me to solve this problem

 

Thanks

embarsu

 

 

Coordinator
Jul 25, 2010 at 8:14 PM

Embarsu,

I'm doing another build this monday/tuesday which will have a fix for this using the .sql install files. In the meantime, if you are using sql express or sql enterprise and you have owner permissions, you can the code base auto-generate the database scheme.

This is done by uncommenting the boot-task named "Database Schema" in global.asax in method public void Configure(AppConfigurator app)

 

-Kishore

Jul 26, 2010 at 2:00 AM

Thank you for your reply.

 

I’m very glad to see your good advice and suddenly followed your suggestion.

However, I can’t find any boot-task named "Database Schema" in Global.asax.

May I did the wrong file. Is it Global.asax in CommonLibrary.CMS project.

If it is convenient for you, please help me to find the line of code that need to be uncommented.

 

Thanks, embarus.

Coordinator
Jul 27, 2010 at 3:46 PM
Edited Jul 27, 2010 at 6:18 PM

Embarus,

Are you using the Beta build ? My suggested answer was regarding the latest source code.

In the latest source code, global.asax, method Configure(AppConfigurator app)... un-comment the boot-task named "Database Schema" below.

            // Non-Fluent API to bootup core bootup tasks for any app, web/non-web.
            bootup.OnStart("Environment",       "core", BootTask.Importance.High,   false, (ctx) => Envs.Set(_ENVIRONMENT_, "prod,qa,dev2:dev,dev", "prod.config,qa.config,dev2.config,dev.config", true, true));
            bootup.OnStart("Configuration",     "core", BootTask.Importance.High,   false, (ctx) => Config.Init(Configs.LoadFiles(configDir, Env.RefPath)));
            bootup.OnStart("Database Config",   "core", BootTask.Importance.High,   false, (ctx) => RepositoryFactory.Add(Config.Get<string>("Database", "connectstr")));
            bootup.OnStart("Forms Auth",        "core", BootTask.Importance.High,   false, (ctx) => FormsAuthentication.Initialize());
            bootup.OnStart("Repositories",      "core", BootTask.Importance.High,   false, (ctx) => app.ConfigureRepositories(useRealData, ctx.Bag));
            bootup.OnStart("Logs",              "core", BootTask.Importance.High,   false, (ctx) => Logger.Default.Replace(new LogDatabase("commons.mvc", "db", ctx.Bag["logRepo"] as IRepository<LogEventEntity>, LogLevel.Debug)));
            bootup.OnStart("Database Clear",    "core", BootTask.Importance.High,   false, (ctx) => app.DeleteData());
            //bootup.OnStart("Database Schema",   "core", BootTask.Importance.High,   false, (ctx) => app.CreateSchema());
            bootup.OnStart("Queues",            "core", BootTask.Importance.High,   false, (ctx) => app.ConfigureQueueProcessing());
           

- Kishore

Coordinator
Aug 3, 2010 at 9:06 PM

There is new stable build available now. The installation instructions are also updated.

-Kishore

Aug 4, 2010 at 1:35 AM

Thank Kishore. It's such a good news for me in this morning.

I have created some custom class and helper for my own ASP.NET MVC Project.

May I contribute them for Commonlibrary.NET CMS.

 

-Embarus

 

 

Aug 6, 2010 at 3:39 AM

So far, I can run CMS with data form SQL Database. However, when I close the program and start it again.

My last created contentment (for example, post) has been lost. I think , on start up the program create remove all content from

post table and then insert new data since primary key increased.

I can't  find the line to be comment to stop create new data and preserve last time data.

Please could you help me to solve this problem.

Thanks,

 

-Embarus

 

Coordinator
Aug 6, 2010 at 5:31 AM
Embarus, In Global.asax, comment out the following lines: Basically, comment out the bootup tasks named "Database Clear", Database Schema", and "Data Load". 1. bootup.OnStart("Database Clear", "core", BootTask.Importance.High, false, (ctx) => app.DeleteData()); 2. bootup.OnStart("Database Schema", "core", BootTask.Importance.High, false, (ctx) => app.CreateSchema()); 3. bootup.OnStart(BootTask.Named("Data Load" ).InGroup("app" ).PriorityNormal.CanFail( ).ActionIs((ctx) => app.LoadData())); Almost all the configuration takes place in global.asax and in the configuration files ( <rootfolder>/config/env/ ) -Kishore
Aug 8, 2010 at 10:34 AM

Kishore, Thank you very very much for your help.

Following your instruction, it works as I expect.     :)

 

- Embarus