[英]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.