问题描述
| DataDirectory目录|,你有一份工作。 | DataDirectory目录|
在IIS7.5解析为:
|DataDirectory|, you had one job. |DataDirectory|
on IIS7.5 resolves to:
C:\的Inetpub \ wwwroot的\ AjaxSource \ App_Data文件
该文件夹不存在。正确的文件夹为:
That folder does not exist. The correct folder is:
C:\的Inetpub \ wwwroot的\ AjaxSource \ BIN \ App_Data文件
一切都很好,在开发计算机上,但是当我部署到服务器,应用程序数据放在仓内\
。我使用的应用程序数据,如图任何Visual Studio 2010的项目和部署以生成部署包的(VS2010),那么的导入应用程序的(IIS管理器)。
All is well on the dev machine, but when I deploy to the server, AppData is placed within bin\
. I use AppData as shown in any Visual Studio 2010 project and deploy with "Build Deployment Package" (VS2010) then "Import Application" (IIS Manager).
我知道我可以AppDomain.SetData或类似手动设置路径,但特征点的我跨pretation是回到正确的位置进行部署在不同的服务器上。这是不是很有用,如果我有到c这条道路很难$ C $。
I know I can set the path manually with AppDomain.SetData or similar, but my interpretation of the point of the feature is to return the correct location for deployment on different servers. It isn't very useful if I have to hard code that path.
连接字符串:数据源= | DataDirectory目录| \ db.sqlite;
我如何 | DataDirectory目录|
返回AppData的路径或替代prevent创造的不必要的斌\
文件夹?
How do I make |DataDirectory|
return the AppData path or alternatively prevent creation of the unnecessary bin\
folder?
推荐答案
这是对我来说太破。我试图复制/不要复制和改变ExcludeApp_Data参数的多种组合,但不能把它一贯的Visual Studio和发布版本之间。为了避免在服务器上的数据的两个副本,我最终发现改变一下在bin / App_Data文件夹的应用程序,首先,如果不检查App_Data文件夹。
It is broken for me too. I tried various combinations of "Copy / Do Not Copy" and changing the "ExcludeApp_Data" parameter but could not get it consistent between Visual Studio and the published version. To avoid having two copies of the data on the server, I ended up changing the application to check the App_Data folder first and if not found to look in the bin/App_Data folder.
这篇关于| DataDirectory目录|返回错误的路径,应用程序数据文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!