简体   繁体   English

托管我的MVC 5实体框架代码第一个项目! 多个错误

[英]Hosting my MVC 5 entity framework code first project ! MULTIPLE ERRORS

I'm trying to host my ASP.NET MVC 5 Entity Framework code first project (the project is running perfectly fine on my machine with local db connection strings) on go daddy. 我正在尝试将我的ASP.NET MVC 5 Entity Framework代码第一个项目(该项目在具有本地db连接字符串的我的机器上运行得很好)托管在爸爸身上。 I've been getting a few errors and I was able to correct them up until now. 我遇到了一些错误,直到现在我都可以纠正它们。

Now I'm getting this error: 现在我得到这个错误:

CREATE DATABASE permission denied in database 'master'. CREATE DATABASE权限在数据库“ master”中被拒绝。

Description: An unhandled exception occurred during the execution of the current web request. 说明:执行当前Web请求期间发生未处理的异常。 Please review the stack trace for more information about the error and where it originated in the code. 请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。

Exception Details: System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in database 'master'. 异常详细信息:System.Data.SqlClient.SqlException:CREATE DATABASE权限在数据库“ master”中被拒绝。

I've removed the trust level option in my web.config file because it was creating problems with CAS trust level in the asp.net net parameters of godaddy. 我删除了我的web.config文件中的信任级别选项,因为它在godaddy的asp.net网络参数中导致了CAS信任级别的问题。 My CAS trust level in go daddy is set to full. 我在go爸爸中的CAS信任级别已设置为完全。

My connection strings: 我的连接字符串:

<add name="DefaultConnection" 
     connectionString="Data Source=ipadress;AttachDbFilename=|DataDirectory|\aspnet-aspProjetFinal-20141211061340.mdf;Initial Catalog=aspnet-aspProjetFinal-20141211061340;Integrated Security=false;User Id=myuser; Password=mypassword;" 
     providerName="System.Data.SqlClient" />
<add name="monModel" 
     connectionString="data source=ipadress;initial catalog=GestionClientsContext;Trusted_Connection=True;Integrated Security=false;MultipleActiveResultSets=True;App=EntityFramework;User Id=myuser; Password=mypassword;" 
     providerName="System.Data.SqlClient" />    

I've tried a few things, for example, this: 我已经尝试了一些方法,例如:

http://forums.asp.net/t/1742970.aspx?CREATE+DATABASE+permission+denied+in+database+master+ http://forums.asp.net/t/1742970.aspx?CREATE+DATABASE+permission+denied+in+database+master+

But I'm not sure if I need to delete some lines after adding said line at the top of the code. 但是我不确定在代码顶部添加该行之后是否需要删除一些行。

My global.asax.cs file: 我的global.asax.cs文件:

public class MvcApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        Database.SetInitializer<GestionClientsContext>(null);
        Database.SetInitializer(new InitialisationGestionClients());
        GestionClientsContext testing = new GestionClientsContext();
        testing.Database.Initialize(true);
        AreaRegistration.RegisterAllAreas();
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
        //throw new Exception(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
    }    

I clearly need some guidance, I've already spent a lot of hours just trying to get it online ! 我显然需要一些指导,我已经花了很多时间才尝试使其在线! Let me know what you think ! 让我知道你的想法 ! Thanks ! 谢谢 !

What you asked for Dan: 您要求Dan:

 public class InitialisationGestionClients : System.Data.Entity.CreateDatabaseIfNotExists<GestionClientsContext>
{
    protected override void Seed(GestionClientsContext context)
    {
        base.Seed(context);
        var lesClients = new List<Clients>
         {
             new Clients{nom="Finch", prenom="Paul",dateInscription=DateTime.Parse("2014-01-10"),adresse="911 De la Commune", email="test@hotmail.com", solde=0,commentaires="Juste un test"}
         };
        lesClients.ForEach(s => context.Clients.Add(s));
        context.SaveChanges();

        var lesFacures = new List<Factures>
        {
            new Factures{motif="Programmes janvier 2014", montant=25,dateFacturation=DateTime.Parse("2014-01-10"),statusPaid=false, ClientsId=1}
        };

        lesFacures.ForEach(s => context.Factures.Add(s));
        context.SaveChanges();

        var lesPaiements = new List<Paiements>
        {
            new Paiements{montant=25,datePaiements=DateTime.Parse("2014-02-10"), ClientsId=1}
        };
        lesPaiements.ForEach(s => context.Paiements.Add(s));
        context.SaveChanges();


    }

}

UPDATE: I've gotten the site to "run" if I can use this word. 更新:如果可以使用此词,则可以让该网站“运行”。 I can now access the application online BUT as soon as I try to login or create a new user, using the MVC login feature, I get the following error: 现在,一旦尝试使用MVC登录功能登录或创建新用户,我就可以在线访问应用程序,但会出现以下错误:

CREATE DATABASE permission denied in database 'master'. CREATE DATABASE权限在数据库“ master”中被拒绝。

I already got that error before when the application was trying to load but I didn't get it since I change the trust level to FULL. 在尝试加载应用程序之前,我已经遇到了该错误,但是由于将信任级别更改为FULL,所以我没有得到它。 I'm not sure I'm following this one ! 我不确定我是否正在关注这个! I'm just trying to login why is he trying to create anything at all ! 我只是尝试登录,为什么他要尝试创建任何东西!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 代码优先实体框架Asp.net MVC - Code First Entity Framework Asp.net MVC 使用MVC 5和Entity Framework 6代码优先的存储过程 - Use stored procedures in MVC 5 & Entity Framework 6 code-first 我的数据库不会先使用实体​​框架代码进行播种 - my database won't seed using entity framework code first 我的sql为代码优先实体框架提供6.4.3.0支持 - my sql provide 6.4.3.0 support for code first entity framework 首先使用实体​​框架代码处理多个数据库及其演变 - Handling multiple database and their evolutions with entity framework code first MCV3实体框架4代码优先:编辑用户多封电子邮件 - MCV3 Entity Framework 4 Code First: Editting Users Multiple Emails 实体框架代码第一个连接 - Entity Framework Code First connection MembershipUser和Entity Framework Code First - MembershipUser and Entity Framework Code First 在使用身份v2和实体框架的Asp.net项目中,如何将所有代码优先模型和用户模型身份移至新项目 - In an Asp.net project using identity v2 and Entity Framework how can I move all my code first models and User model identity to a new project 在实体框架中使用数据库优先实体和代码优先实体 - Using database first entity with code first entity in entity framework
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM