试图让Web方法异步 [英] Trying to make Web Method Asynchronous

查看:115
本文介绍了试图让Web方法异步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前工作的项目包括MS SQL Server和使用Session变量ASP.net Web服务。显然,这将导致客户端的呼叫以顺序的方式来执行。我想确保这些方法异步执行。

The project I am currently working on involves MS SQL Server and ASP.net Web Services that use Session variables. Apparently this causes a client's calls to execute in a sequential manner. I want to make sure that these methods execute asynchronously.

在做一些研究后,在我看来,最上等的方法是使用跟踪会话(使用GUID的说)和独立的表为每个会话表来坚持在数据库中的会话状态。

After doing some research it appears to me the choicest method is to persist the session state in the database using a table that tracks sessions ( using guids say ) and separate tables for each session.

在我直接潜入这个我需要知道,如果我能获得异步操作的相同意义的Web服务,如果我配置SQL Server存储会话。

Before I dive directly into this I need to know if I can gain the same sense of asynchronous operations for the web service if I configure SQL Server to store the session.

可以吗?

推荐答案

很抱歉这么说,但异步执行你的code和使用会话变量的唯一方法是使你完全自定义会话的解决方案 - 我的意思完全定制的,完全禁用asp.net会话。

Sorry to say that, but the only way to execute asynchronously your code and use session variables is to make your totally custom session solution - and I mean totally custom and disable the asp.net session entirely.

基本的提示,使您的会话:

Basic tips to make your session:


  1. 您已经一个cookie中的用户的数据连接

  2. 的数据是在一个表上的数据库。

  3. 您做出该表上的每个会话的自定义字段,避免字典<>让他们

  4. 您是脏读工作,最后写胜

  5. 您读取和写入只需要每次(不是全部一起)会话变量

  6. 每行有一个时间过时,并使用如MS,SQL上删除旧的会话sheduler。

  7. 加载会议preINIT ,不仅节省什么有变化 onunload的

  8. 将完全禁用会话,您需要使用互斥 code,现在是做工精细,因为会议是使具有不同步注意到它锁定,但出会话锁定可能执行两次,像新的一样插入到数据库调用。

  1. You have one cookie connected with the users data
  2. The data is on one table on your database.
  3. You make custom fields on that table for each session and avoid Dictionary<> to keep them
  4. You work with Dirty read, last write wins
  5. You read and write only the session variables that you need each time (not all together)
  6. Each line have a time out date, and use like MS, a sheduler on SQL to delete old sessions.
  7. Load session on OnPreInit, save only what have change on OnUnload
  8. By entirely disable the session, you need to lock using Mutex code that now is work fine because the session is make synchronization with out notice it, but with out session lock maybe execute two times, like new inserting to database calls.

相对的:

<一个href=\"http://stackoverflow.com/questions/9426673/web-app-blocked-while-processing-another-web-app-on-sharing-same-session\">Web应用程序被阻止在处理上共享同一个会话结果另一个Web应用程序
<一href=\"http://stackoverflow.com/questions/9056240/what-perfmon-counters-are-useful-for-identifying-asp-net-bottlenecks/9056650#9056650\">What性能计数器对于识别ASP.NET瓶颈有用吗?结果
更换ASP.Net的会议完全

Web app blocked while processing another web app on sharing same session
What perfmon counters are useful for identifying ASP.NET bottlenecks?
Replacing ASP.Net's session entirely

回答和对这个问题如果我配置SQL Server存储会话?会话仍然锁定并阻止其余的请求。如果您有SQL服务器或其他介质上的会话并没有改变工作,只有保存的数据的地方的生活方式。

to answer and to this question if I configure SQL Server to store the session ? the session is still lock and block the rest request. If you have the session on SQL server or on other medium is not change the way of working, only the place of the saved data.

这篇关于试图让Web方法异步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆