Silverlight enhanced WebService where to save SQLight database
In my current project, a Silverlight-Client with a WebService as backend, I need a hint on where to save the database-file of the WebService that is a SQLight file.
Since the WebService is merely开发者_运维知识库 a mediator between the Silverlight-Client and a native Service on the Server, just some little data needs to be stored on WebService-side, so SQLight was the choosen here.
While developing I just put used: "%AppData%\ServiceName\" as path for the database, but how is it going to behave if it is deployed on an IIS? Will it work? What would the whole Path look like if I want to access the file manually?
What is the best behaviour in this? Where to put the database file for a WebService right?
I advise, as a matter of best practice, to install IIS on your devmachine and develop and test on that. There is an option to debug from VS in your IIS, see Project Settings > Debug. That way, if it works on your develop it'll have better chances of working on the server.
As for a path for the database: You should set this in a config setting and store the database outside of the webfolder in a reserved location.
However, if you really have to store the database in the working folder; Google gave me this:
Server.MapPath(".")
gives you your "current webfolder".
精彩评论