Silverlight增强的WebService在哪里保存SQLight数据库
在我当前的项目中,一个以 WebService 作为后端的 Silverlight 客户端,我需要提示将 WebService 的数据库文件(即 SQLight 文件)保存在哪里。
由于WebService只是Silverlight客户端和服务器上的本机服务之间的中介,只需要在WebService端存储一些小数据,因此这里选择了SQLight。
在开发时,我只是将使用:“%AppData%\ServiceName\”作为数据库的路径,但是如果将其部署在 IIS 上,它将如何表现?它会起作用吗?如果我想手动访问该文件,整个路径会是什么样子?
这方面最好的行为是什么? WebService 的数据库文件应该放在哪里?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为最佳实践,我建议在您的开发机器上安装 IIS 并在其上进行开发和测试。有一个选项可以从 IIS 中的 VS 进行调试,请参阅“项目设置”>“调试。这样,如果它适用于您的开发,它将有更好的机会在服务器上工作。
至于数据库的路径:您应该在配置设置中进行设置,并将数据库存储在 Web 文件夹之外的保留位置。
但是,如果您确实必须将数据库存储在工作文件夹中;谷歌给了我 this:
为您提供“当前网络文件夹”。
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:
gives you your "current webfolder".