简体   繁体   中英

ASP.NET - using another app's app_data?

If there is a self contained web app, let's use the Screw Turn Wiki as an example, that utilizes the App_Data to store the MDF, is there any way another web app, living in the same domain, can also use that MDF?

Example IIS Setup:

http://wiki.domain.com | c:\web\wiki | port 80  
http://www.domain.com  | c:\web\site | port 80

My WWW web app would like to pull some data from the WIKI app. Without moving the MDF to a full fledged SQL Server is there a way to do this? Also note, the WIKI app is an installed app so I don't have access to its source.

TIA

Neither application should be using the MDF directly. Both should be accessing the data through a Data Access Layer of some kind.

Given that the Wiki app controls the data access for itself, it seems that your webapp should have its own datalayer component that accesses the SQL Server datastore from the wiki.

That would give any other app the ability to read into that SQL layer as it might want to.

If you want to connect to any .mdf on the server, use this connection string in your datalayer.

Server=MySqlServer;AttachDbFilename=c:\\myDbFile.mdf;Database=dbName; Trusted_Connection=Yes;

More examples of connection strings to load an MDF into SQL Server .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM