MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

MVC 5 area in version 4.9  (Mono Support )

Viewed 15211 time(s), 4 post(s) 6/16/2014 7:36:45 AMby inanc
inanc

inanc

6/16/2014 7:36:46 AM
Hi,
I am looking for a simple way  to mix the latest stable release of MonoX with MVC 5.1  just because of scaffolding feature.
I have reviewed several articles.  I think the easiest way is to add new scaffolded  item to the MonoX project by using Visual Studio 2013 with update 2 installed. In this case every required item required  to work with MVC will be added automatically to the project and also a global.asax file. But i think there is a problem with that approach. If you don't delete the 'precompiledapp.config' file form the original MonoX project, the events in the global.asax file like 'Application_Start()' is not being fired! Maybe a solution to this issue is, putting the lines given below to  the default page's OnPage_Load event by allowing them to be hit only once. 
      AreaRegistration.RegisterAllAreas();
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
But I think the formal way   to solve the issue is using them in global.asax. But how could be to have a global.asax file with the existence of the 'precompiledapp.config' file?
If I delete the ''precompiledapp.config', the MonoX doesn't work properly..

Do you know a formal way to mix the Monox with the MVC pattern? Thank you very much!

Inanc
This content has not been rated yet. 
469 Reputation 60 Total posts
khorvat

khorvat

6/16/2014 9:35:34 AM
Hi,

the proper way is to delete the "precompiledapp.config" because you are creating a new application on top of the MonoX that means that this isn't a precompiledapp.config any more. Please let us know which error you get when you delete the file in order to solve the issue and do everything properly ?

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
inanc

inanc

6/25/2014 12:22:07 PM
Dear Khorvat,
Thank you for your answer. I am explaining the steps that I followed below.

i) I've installed a clean  MonoX 4.9 on one of my local directory using VS 2013 with Update2 . No problem for now.Everything is OK.

ii) Upgraded MonoX 4.9 Project to  latest ASP.NET framework version. e.g. 4.5.1 by using VS 2013 and compiled and deleted ''precompiledapp.config' file run it again.Everything is OK.

iii) I've added an Entitiy Framework 6.0 database first domain model by chosing a table from a test database.

iv) By right clicking the project on the Solution explorer and chosing the Add->New Scaffolded Item, the solution file structure seemed like given by 'AfterScaffolding.jpg'. Please find the image in the uploads. Meanwhile the Solution still builds well but the error comes with the content :

Server Error in '/' Application.Runtime ErrorDescription: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated. 

You can find image in the uploads again with the name error.jpg

I've set the debug="true" in the web.config but it doesn't matter, no use, there is no meaningful error explanation.
After scaffolding and running the app, debugger hits the  Application_Start() event in global.asax succesfully and passed the each line in the event without error.

                AreaRegistration.RegisterAllAreas();
           FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
           RouteConfig.RegisterRoutes(RouteTable.Routes);
           BundleConfig.RegisterBundles(BundleTable.Bundles);
 But after successfully rendering the last line -BundleConfig.RegisterBundles(BundleTable.Bundles)- VS throws the error that I've mentioned above.

I hope I could explain all steps clearly..
Thank you..
This content has not been rated yet. 
469 Reputation 60 Total posts
khorvat

khorvat

6/25/2014 12:27:50 PM
Hi,

can you please check the error logs and get back to us as this error doesn't tell us too much.

Thanks
This content has not been rated yet. 
15993 Reputation 2214 Total posts