我試圖託管我的ASP.NET MVC 5實體框架代碼第一個項目(該項目運行完美,我的機器上有本地數據庫連接字符串)在去爸爸。我一直在收到一些錯誤,直到現在我才能糾正它們。託管我的MVC 5實體框架代碼第一個項目!多個錯誤
現在,我得到這個錯誤:
CREATE DATABASE permission denied in database 'master'.
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.Data.SqlClient.SqlException: CREATE DATABASE permission denied in database 'master'.
我已經刪除了信任級別選項在我的web.config文件,因爲它是在的asp.net網絡參數創建與CAS信任級別問題去吧爸爸。我父親的CAS信任級別已滿。
我的連接字符串:
<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" />
我已經嘗試了一些東西,比如,這樣的:
http://forums.asp.net/t/1742970.aspx?CREATE+DATABASE+permission+denied+in+database+master+
但我不知道我是否需要刪除一些線路在代碼頂部添加所述行後。
我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);
}
我顯然需要一些指導,我已經花了很多的時間只是想在網上得到它!讓我知道你的想法 !謝謝 !
你能向我們展示'InitialisationGestionClients()'初始化器嗎?你在使用「DropCreateDatabaseIfModelChanges」方案嗎?如果是這樣,那可能是原因,因爲GoDaddy不允許你從代碼中刪除或創建數據庫,只有控制面板。 – Dan 2014-12-28 03:54:06
您的數據庫是否已經存在?,您是否在聯繫人中設置了連接字符串?或有管理員用戶訪問你的數據庫在SQL? – Aria 2014-12-28 18:34:04
我的2個DB已經存在,一個連接到上下文,另一個連接登錄和角色。我自己在服務器上創建了它們。 – TopCheese 2014-12-29 18:34:56