MVC代码优先:未创建App_Data文件夹 [英] MVC Code First: App_Data Folder Not Being Created

查看:248
本文介绍了MVC代码优先:未创建App_Data文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MVC Code First方法创建SQL Compact数据库(来自WebConfig:data source = | DataDirectory | MailBoxDB.sdf)。 .sdf文件应该自动创建,如果我在Web服务器上手动创建App_Data文件夹(Windows Server 2008),则会生成.sdf文件。但是,我正在尝试自动化部署过程,我想要消除此手动步骤。我正在使用MSDeploy来创建部署包。是否存在阻止IIS(7.5)自行创建App_Data文件夹的权限问题?如果是这样,我应该关注哪些设置?有什么想法吗?

I'm using the MVC Code First approach to create a SQL Compact database (from WebConfig: data source=|DataDirectory|MailBoxDB.sdf). The .sdf file should get created automatically, and it does if I manually create the App_Data folder on the web server (Windows Server 2008). However, I'm trying to automate the deployment process and I want to eliminate this manual step. I'm using MSDeploy to create the deployment package. Is it a permissions issue that prevents IIS (7.5) from creating the App_Data folder on its own? If so, which settings should I be focusing on? Any ideas?

推荐答案

我有一个类似场景(通常更复杂,但没有数据库在App_Data中)。我拼凑了几个SO问题,找到了一个解决方案,我在同一主题的问题上发布了这个问题。看看我的答案,希望它有所帮助。

I had a similar scenario (generally more complex, although without a database in App_Data). I pieced together several SO questions and found a solution which I've posted on my question on the same topic. Take a look at my answer and hopefully it helps.

这篇关于MVC代码优先:未创建App_Data文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆