Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6330427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:52:05+00:00 2026-05-24T17:52:05+00:00

Setup MVC 3 EF 4.1 Code First – Windows 7 Pro 64 Dev machine,

  • 0

Setup

MVC 3 EF 4.1 Code First – Windows 7 Pro 64 Dev machine, Separate Win 7 Pro for host.

I started with a SQLCE4.0 database, and everything worked fine (database initializer created tables, populated, etc…).

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.

Problem
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.

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:

CREATE DATABASE permission denied in database ‘master’.

I commented out the DBInitializer setup so nothing should be created upon a db hit. The tables are there already.

If I do Database.SetInitializer(null); then I get a different login error:

I don’t remember exactly but it was something to the affect of LOGIN FAILED FOR IIS APPPOOL\ApplicationPoolIdentity

So I changed the Identity to NETWORK SERVICE and even tried LOCAL SERVICE, both giving the same login failed error.

I tried following this post who says add a SQL user named ‘IIS APPPOOL\MyApplicationName’. SQL Wont let me do that as it has invalid characters … go figure.

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? I’ve scoured the net and tried different things.

EDIT: Here are my connection strings:

<add name="AntripContext" connectionString="Data Source=|DataDirectory|AntripWeb.sdf" providerName="System.Data.SqlServerCe.4.0" />
    <!--<add name="AntripSQL" connectionString="Data Source=.\sqlexpress;Initial Catalog=Antrip;User Id=myuser;Password=mypassword;" providerName="System.Data.SqlClient" />-->
    <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=&quot;Data Source=|DataDirectory|\AntripWeb.sdf&quot;" providerName="System.Data.EntityClient" />
    <!--<add name="AntripWebEntities" connectionString="metadata=res://*/DAL.AntripEntities.csdl|res://*/DAL.AntripEntities.ssdl|res://*/DAL.AntripEntities.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\sqlexpress;Initial Catalog=Antrip;User Id=myuser;Password=mypassword;&quot;" providerName="System.Data.EntityClient" />-->

Note: The commented out connection strings are the ones that use the sql 2008 database (that break my published app).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:52:06+00:00Added an answer on May 24, 2026 at 5:52 pm

    It sounds to me as if your connection string has Integrated Security=true so that you are connecting to SQL as the user you specify, rather than the SQL user you think you are using?

    But beware, its still trying to create a database: you need to swap the IDatabaseInitializer – I guess it will look for a DB named the same as the entitys to be careful!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to setup ASP.NET MVC 2 to work with a MySQL database?
I am using Entity Framework 4.1 code first and ASP.NET MVC 3 and I
I'm building an ASP.NET MVC 3 site using the code-first Entity Framework 4 approach.
I am using Entity Framework 4.1 code first and ASP.NET MVC 3. I have
I am not planning to use EF Code First in an MVC Website. I
I am currently building my first MVC 3 application, using EF Code First, SQL
I'm trying to use the Entity Framework code first without an existing database. I
I'm trying to use the mini-profiler with old-style EF code - database-first. So far:
I am trying to setup Spring MVC 3.0 to support localization. The messages are
In a classic Zend Framework MVC setup, there seems to be access to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.