|DataDirectory|, you had one job. |DataDirectory|
on IIS7.5 resolves to:
C:\inetpub\wwwroot\appname\App_Data
That folder does not exist. The correct folder is:
C:\inetpub\wwwroot\appname\bin\App_Data
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).
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.
The connection string: "Data Source=|DataDirectory|\db.sqlite;"
How do I make |DataDirectory|
return the AppData path or alternatively prevent creation of the unnecessary bin\
folder?
@"Data Source=|DataDirectory|\db.sqlite;"
, otherwise it is going to look for a file namedApp_Datadb.sqlite
. – Dysprosium<h1>@AppDomain.CurrentDomain.GetData("DataDirectory")</h1>
(which strangely wasn't documented). – Ellersick