Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC 3 - After publishing to server - CREATE DATABASE permission denied in database 'master'
    primarykey
    data
    text
    <p><strong>Setup</strong> </p> <p>MVC 3 EF 4.1 Code First - Windows 7 Pro 64 Dev machine, Separate Win 7 Pro for host.</p> <p>I started with a SQLCE4.0 database, and everything worked fine (database initializer created tables, populated, etc...).</p> <p>Once I got everything working like I wanted, I scripted out my SqlCe DB, created a real SQL 2008 DB, opened the proper ports and enabled TCP connections.</p> <p><strong>Problem</strong> <br/> IF I Change my connection string to point to my intranet server\instance name, with a user I created for this app specifically, it works perfectly running from my dev machine.</p> <p>IF I publish the app to the server (the web server and sql server are the same), and I try to login to the website (aka access the db), then I get:</p> <p><strong><em>CREATE DATABASE permission denied in database 'master'.</em></strong></p> <p>I commented out the DBInitializer setup so nothing should be created upon a db hit. The tables are there already.</p> <p>If I do Database.SetInitializer(null); then I get a different login error:</p> <p>I don't remember exactly but it was something to the affect of <strong><em>LOGIN FAILED FOR IIS APPPOOL\ApplicationPoolIdentity</em></strong></p> <p>So I changed the Identity to NETWORK SERVICE and even tried LOCAL SERVICE, both giving the same login failed error.</p> <p>I tried following <a href="https://stackoverflow.com/questions/454497/iis7-sql-2008-and-asp-net-mvc-security">this</a> post who says add a SQL user named 'IIS APPPOOL\MyApplicationName'. SQL Wont let me do that as it has invalid characters ... go figure.</p> <p><em>Why does it work perfectly over the network accessing the DB from my dev machine, but when I publish to THE SAME machine that hosts the sql and the site, I get permission denied or login failed errors?</em> I've scoured the net and tried different things.</p> <p>EDIT: Here are my connection strings:</p> <pre><code>&lt;add name="AntripContext" connectionString="Data Source=|DataDirectory|AntripWeb.sdf" providerName="System.Data.SqlServerCe.4.0" /&gt; &lt;!--&lt;add name="AntripSQL" connectionString="Data Source=.\sqlexpress;Initial Catalog=Antrip;User Id=myuser;Password=mypassword;" providerName="System.Data.SqlClient" /&gt;--&gt; &lt;add name="AntripWebEntities" connectionString="metadata=res://*/DAL.AntripEntities.csdl|res://*/DAL.AntripEntities.ssdl|res://*/DAL.AntripEntities.msl;provider=System.Data.SqlServerCe.4.0;provider connection string=&amp;quot;Data Source=|DataDirectory|\AntripWeb.sdf&amp;quot;" providerName="System.Data.EntityClient" /&gt; &lt;!--&lt;add name="AntripWebEntities" connectionString="metadata=res://*/DAL.AntripEntities.csdl|res://*/DAL.AntripEntities.ssdl|res://*/DAL.AntripEntities.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;Data Source=.\sqlexpress;Initial Catalog=Antrip;User Id=myuser;Password=mypassword;&amp;quot;" providerName="System.Data.EntityClient" /&gt;--&gt; </code></pre> <p>Note: The commented out connection strings are the ones that use the sql 2008 database (that break my published app).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload