多个用户在ASP.Net中同时访问Webservice [英] Multiple user accessing Webservice simultaneously in ASP.Net

查看:163
本文介绍了多个用户在ASP.Net中同时访问Webservice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在webservice asp.net 2.0(VB)中创建了一个webmethod,它可以在整个应用程序中非常频繁地访问。 webmethod将查询作为参数获取并返回数据集。当用户数为1或2时,它工作正常。如果有30个用户同时使用系统,webmethod将返回不同查询的数据集。我们使用了synclock(C#中的LOCK)选项,这是没用的。



We have a webmethod created in webservice asp.net 2.0 (VB), which is accessed throughout the application very frequently. The webmethod gets the query as parameter and returns the dataset. It works fine when number of users are 1 or 2. If some 30 users are using the system simultaneously webmethod returns the dataset of a different query. We have used synclock(LOCK in C#) option which is of no use.

Public Function ExecuteQry(ByVal StrText As String) As DataSet

        Dim AdoDs As New DataSet()
        Dim SqlDp As New SqlDataAdapter
        Dim SqlCmd As New SqlCommand
        Dim SqlParam As New SqlParameter

        Try
            SyncLock AdoDs
                MakeConnect()
                With SqlCmd
                    .Connection = SqlCon
                    .CommandText = "rExecuteQry"
                    .CommandType = CommandType.StoredProcedure
                End With
                SqlParam = SqlCmd.Parameters.AddWithValue("@strText", Trim(StrText))
                SqlDp.SelectCommand = SqlCmd
                SqlDp.Fill(AdoDs)
                DisposeConnect()
                Return AdoDs
            End SyncLock
        Catch ex As SqlException
            DisposeConnect()
            Debug.Write(ex.Message)
        Finally

            SqlCmd = Nothing
            SqlParam = Nothing
        End Try
    End Function







以下是存储过程:



ALTER PROCEDURE [dbo]。[rExecuteQry] @strText Varchar(max)as Exec(@StrText)




Below is the Stored Procedure:

ALTER PROCEDURE [dbo].[rExecuteQry] @strText Varchar (max) as Exec( @StrText)

推荐答案

这篇关于多个用户在ASP.Net中同时访问Webservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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