I have this application which I am developing for learning purpose. I have hosted the application on AppHarbor.
It is ASP.NET MVC and EF Code First.
I added the SQL server free add on for db purpose but come what may the db connectivity is failing.
Code is hosted on Github here :- https://github.com/BilalHasanKhan/BusinessFlow
Please advise or point where I am wrong.
By switching custom error off I found the error:
Model compatibility cannot be checked because the database does not
contain model metadata. Ensure that IncludeMetadataConvention has been
added to the DbModelBuilder conventions.
You might want to check the blog post we recently did on migrations with EF Code First. There's also example code to along with the post.
Related
I created an simple skeletal web application. I created only a simple blank JSF page. Right click and run. Then I got the following message in the Log console.
The Server Instance cannot be started because the Integrated Weblogic domain was not built successfully.
Can anybody suggest me why I am getting this error?
Your question does not provide detailed information.
The best way would be to go to weblogic domain options from start menu and create a new domain.
Then link that domain in jdeveloper and use the same. Delete the integrated domain i.e. base_domain folder.
There were 2 ways this problem can be fixed:
Try starting and fixing any issues with the Integrated weblogic domain. Till that is not starting successfully, JDeveloper cannot do anything on that. For me one time startup of the current domain outside of the Jdeveloper solved the issue. After that it was working fine from JDeveloper too.
Another option is as stated by vijayinani above to create a new domain and link it. But, beware your integrated base_domain is not having anything which you need to preserve if you plan to delete that.
I'm attempting to use the ASP.NET universal providers in my MVC4 application. Among other places, this article describes how, the first time you attempt to register a user, the tables should auto-create in my DB.
I had this working on my internal app/db, but I used the asp.net web configuration tool to create my first user. When I deployed this to production, I attempted to register a user and was hit with an error indicating dbo.Applications didn't exist, which is one of the tables that should have been created.
Any thoughts on why these tables weren't created? I've made sure the System.Web.Providers dll was copied to the bin folder. I'm also sure my app can manage CRUD tasks on my database.
argh duh. Turns out I didn't have create perms set up for the app pool identity that was making the call. Hangs head in shame
I got my app running very well when I was testing locally, with Membership providers and Database. My nightmare began when I tried to run it in Windows Azure plataform.
Since then, I read a lot of articles about running aspnet_regsql in Sql Azure, and the new universal Membership providers. But I can't realize how to use the new Providers, and I'm getting really confused about System.Web.Providers and System.Web.Security classes and methods. When I tried to create a new user with the new Providers, the creation failed with a Null Exception, even if I had all the parameters placed and the build was ok.
My project is totally ready, I just need to upload it to the host.
How could I make it run in Windows Azure easily? Or should I learn how to use the new universal Providers and adjust all my project to that?
It appears that System.Web.Providers is required to run your application on Azure, at least without any heavy code lifting. Scott Hanselman outlines the basics of installing and using System.Web.Providers in his recent blog post: Introducing System.Web.Providers - ASP.NET Universal Providers for Session, Membership, Roles and User Profile on SQL Compact and SQL Azure.
Another resource that may be helpful is Wade Wegner's post Deploying the Windows Azure ASP.NET MVC 3 Web Role.
In short, after installing System.Web.Providers in your project using NuGet, it will reconfigure your web.config to include two connections strings, one for ApplicationServices, and another for the DefaultConnection. You will need to updated these with your Azure connection string, but make sure you append "MultipleActiveResultSets=True;" to both connection strings.
I've created a Web Matrix web site from the starter template which creates a database with the a few tables for the login details. Most of these are names webpages_Membership, webpages_Roles etc. The hosting company I use only gives me one database and I want to have more than one site on the server. I want to prefix the table name with something to make it unique, but it looks like the web matrix framework will only work with the set table name. Does anyone know if this is possible?
If you use SQL Server Compact Edition, you can have as many databases as you like in your App_Data folder. Certainly something to consider if your sites aren't likely to be hugely busy. Otherwise you can develop your own Provider inheriting from ExtendedMembershipProvider and make it "site-aware". Dig around in the WebMatrix.Data source code for more details (available as part of the MVC source download).
I've just started learning .NET MVC so this may be a silly question, but I've yet to find a good answer.
I'm following the Code First approach using the Entity Framework to build my database for me. I've included the following in my Application_Start() method in order to allow me to edit my database by making changes to my Model objects.
Database.SetInitializer<ContactManagerDB>(new DropCreateDatabaseIfModelChanges<ContactManagerDB>());
I was just wondering what would happen if I pushed this application to a production environment and then made a few changes to my models and then updated the application? Would this really drop and recreate the database in the production environment?
What's the best practice for pushing changes to production env. using the Code First approach?
DropCreateDatabaseIfModelChanges should only be use early on in development, never on a production machine. If you pushed to a production machine and made schema changes, you'd loose all your data.
You could delete the EdmMetadata table in your production environment. In that case, EF would not know the current schema to compare to the new, so it would just assume you know what you are doing and it would not touch the database schema.
Code first does not have the ability to upgrade your database while keeping your data intact.