C# ASMX Web服务半永久存储要求

发布于 2024-07-12 03:35:45 字数 516 浏览 4 评论 0原文

我正在编写第三方 Web 服务的模拟,以便我们能够开发和测试我们的应用程序。

我需要模拟允许用户提交数据的功能,然后在将来的某个时刻检索服务的处理结果。 我需要做的是将提交的数据保存在某个地方,并稍后检索它(而不是在同一个会话中)。 我想做的是将数据保存到数据库(最简单的解决方案),但托管模拟服务的环境不允许这样做。

我尝试使用IsolatedStorage(应用程序范围),但这似乎在我的实例中不起作用。 (我正在使用以下内容来获取商店......

IsolatedStorageFile.GetStore(IsolatedStorageScope.Application | 
    IsolatedStorageScope.Assembly, null, null);  

我想我的问题是(记住我了解IsolatedStorage的局限性这一事实)我将如何让它发挥作用?如果没有一致的方法这样做,我想我将不得不回退到坚持到文件系统上的特定文件位置,以及我们环境中需要的权限设置的所有痛苦。

I'm writing a mock of a third-party web service to allow us to develop and test our application.

I have a requirement to emulate functionality that allows the user to submit data, and then at some point in the future retrieve the results of processing on the service. What I need to do is persist the submitted data somewhere, and retrieve it later (not in the same session). What I'd like to do is persist the data to a database (simplest solution), but the environment that will host the mock service doesn't allow for that.

I tried using IsolatedStorage (application-scoped), but this doesn't seem to work in my instance. (I'm using the following to get the store...

IsolatedStorageFile.GetStore(IsolatedStorageScope.Application | 
    IsolatedStorageScope.Assembly, null, null);  

I guess my question is (bearing in mind the fact that I understand the limitations of IsolatedStorage) how would I go about getting this to work? If there is no consistent way to do it, I guess I'll have to fall back to persisting to a specific file location on the filesystem, and all the pain of permission setting that entails in our environment.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云朵有点甜 2024-07-19 03:35:45

自答。

出于开发和测试的目的,我意识到限制持久对象的生命周期并用于

HttpRuntime.Cache 

存储对象是最简单的。 这具有足够的灵活性来应对我的情况。

Self-answer.

For the pruposes of dev and test, I realised it would be easiest to limit the lifetime of the persisted objects, and use

HttpRuntime.Cache 

to store the objects. This has just enough flexibility to cope with my situation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文