473,803 Members | 3,431 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Single instance???

Hi guys

I have facing a small problem, it's like this.

There is a web service which has a web method call OpenPublicConne ction
which will open a connection to the SQL Server, and there is a web method
call StartTransactio n to start a tranaction for the class level connection
which is opened by the OpenPublicConec tion Method. But when I call
StartTransactio n it's retruing an error saing the connection is closed... ?
Is there anyway to fix this?? is there anyway to keep the conneciton object
alive in the server side till client call the StartTransactio n Method after
calling the OpenPublicConne ction method...?

Thanks for your help
-Aruna
Nov 23 '05 #1
4 1466
One way is you can utilise ASP.Net Session state framework to achieve
this. or you can create a singleton remoting object on the server.

regards
erymuzuan mustapa

Sniper wrote:
Hi guys

I have facing a small problem, it's like this.

There is a web service which has a web method call OpenPublicConne ction
which will open a connection to the SQL Server, and there is a web method
call StartTransactio n to start a tranaction for the class level connection
which is opened by the OpenPublicConec tion Method. But when I call
StartTransactio n it's retruing an error saing the connection is closed... ?
Is there anyway to fix this?? is there anyway to keep the conneciton object
alive in the server side till client call the StartTransactio n Method after
calling the OpenPublicConne ction method...?

Thanks for your help
-Aruna

Nov 23 '05 #2
erymuzuan wrote:
One way is you can utilise ASP.Net Session state framework to achieve
this. or you can create a singleton remoting object on the server.

regards
erymuzuan mustapa

Sniper wrote:
Hi guys

I have facing a small problem, it's like this.
There is a web service which has a web method call
OpenPublicConne ction which will open a connection to the SQL Server,
and there is a web method call StartTransactio n to start a tranaction
for the class level connection which is opened by the
OpenPublicConec tion Method. But when I call StartTransactio n it's
retruing an error saing the connection is closed... ? Is there anyway
to fix this?? is there anyway to keep the conneciton object alive in
the server side till client call the StartTransactio n Method after
calling the OpenPublicConne ction method...?

Thanks for your help
-Aruna


You could try to solve this problem, but I think the problem is in your
web service design. You should not leave open database
connections/transactions between web service calls - this is very
inefficient and can cause many problems when clients will be making
concurrent calls to your web service.
Better think how to make your web service stateless.

Best regards
Rafal Gwizdala
Nov 23 '05 #3
Aruna,
There is a way to use transactions in a web service. Since it is stateless,
you must keep track of the user who made the request. You may want to have a
collection of "ActiveUser s" which is going to have as part of its fields
userId and connection. Whenever you start a transaction you can return a
unique Id. You must provide that Id whenever you make another request to the
web service (Update, Insert, Delete). The web service is going to loop throw
the collection and find the user with the specified Id. Once the user is
found, you can grab the connection and pass it to the Update, Insert or
Delete methods so that the connection doesnt get closed.
Then you can call the Comit or Rollback.

Gilberto

connections/transactions between web service calls - this is very
inefficient and can cause many problems when clients will be making
concurrent calls to your web service.
Better think how to make your web service stateless.
"Rafal Gwizdala" wrote:
erymuzuan wrote:
One way is you can utilise ASP.Net Session state framework to achieve
this. or you can create a singleton remoting object on the server.

regards
erymuzuan mustapa

Sniper wrote:
Hi guys

I have facing a small problem, it's like this.
There is a web service which has a web method call
OpenPublicConne ction which will open a connection to the SQL Server,
and there is a web method call StartTransactio n to start a tranaction
for the class level connection which is opened by the
OpenPublicConec tion Method. But when I call StartTransactio n it's
retruing an error saing the connection is closed... ? Is there anyway
to fix this?? is there anyway to keep the conneciton object alive in
the server side till client call the StartTransactio n Method after
calling the OpenPublicConne ction method...?

Thanks for your help
-Aruna


You could try to solve this problem, but I think the problem is in your
web service design. You should not leave open database
connections/transactions between web service calls - this is very
inefficient and can cause many problems when clients will be making
concurrent calls to your web service.
Better think how to make your web service stateless.

Best regards
Rafal Gwizdala

Nov 23 '05 #4
Aruna,
There is a way to use transactions in a web service. Since it is stateless,
you must keep track of the user who made the request. You may want to have a
collection of "ActiveUser s" which is going to have as part of its fields
userId and connection. Whenever you start a transaction you can return a
unique Id. You must provide that Id whenever you make another request to the
web service (Update, Insert, Delete). The web service is going to loop throw
the collection and find the user with the specified Id. Once the user is
found, you can grab the connection and pass it to the Update, Insert or
Delete methods so that the connection doesnt get closed.
Then you can call the Comit or Rollback.

Gilberto

connections/transactions between web service calls - this is very
inefficient and can cause many problems when clients will be making
concurrent calls to your web service.
Better think how to make your web service stateless.
"Rafal Gwizdala" wrote:
erymuzuan wrote:
One way is you can utilise ASP.Net Session state framework to achieve
this. or you can create a singleton remoting object on the server.

regards
erymuzuan mustapa

Sniper wrote:
Hi guys

I have facing a small problem, it's like this.
There is a web service which has a web method call
OpenPublicConne ction which will open a connection to the SQL Server,
and there is a web method call StartTransactio n to start a tranaction
for the class level connection which is opened by the
OpenPublicConec tion Method. But when I call StartTransactio n it's
retruing an error saing the connection is closed... ? Is there anyway
to fix this?? is there anyway to keep the conneciton object alive in
the server side till client call the StartTransactio n Method after
calling the OpenPublicConne ction method...?

Thanks for your help
-Aruna


You could try to solve this problem, but I think the problem is in your
web service design. You should not leave open database
connections/transactions between web service calls - this is very
inefficient and can cause many problems when clients will be making
concurrent calls to your web service.
Better think how to make your web service stateless.

Best regards
Rafal Gwizdala

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
10143
by: Elad | last post by:
Hi, I have an application that is made up of several executables. I need all these executables to use the same instance of an object. What is the best, most efficient way to approach this? Thanks a lot!
18
5664
by: Steve Barnett | last post by:
I want to ensure that there is only ever one instance of my app running on a single PC at any time. I understand that I can achieve this by using a mutex and, if I can't take ownership of the mutex, I know there is another instance of my program running. Problem is, how do I get the "new" instance to communicate with the "old" instance? The new one will have been started with a command line parameter that I want to pass to the old...
7
2164
by: jsale | last post by:
I have made an ASP.NET web application that connects to SQL Server, reading and writing data using classes. I was recommended to use session objects to store the data per user, because each user using the application needs to see their own data only. My problem is that when multiple users are in the application, when in the session object, data is fine, however as there is only one instance of the class files, when data is put into them,...
1
1418
by: Maileen | last post by:
Hi, How can i do (and test) a single instance of my form ? thanks, Maileen
9
5116
by: MrSpock | last post by:
1. Create a new Windows Application project. 2. Open the project properties and check "Make single instance application". 3. Build. 4. Go to the release folder and run the application. 5. Try to open a second instance of the application. This will cause an unhandled exception and the "Send Error Report" box shows up. Does this happen to anyone else, or is it just me? Debug info: "Unhandled exception at 0x00e149fd in...
3
3151
by: sadanjan | last post by:
Hi , Appreciate if someone can clarify if database Share Memory Limit (2 GB ) in Unix 32 bit boxes is the top limit for all the databases put together in a database or is it for each of the database in an Instance Thanks & regards sadanjan
3
7198
by: Mark Jerde | last post by:
VS 2005. When I google "CSharp single instance form" the returned pages usually use a Mutex or the VB.NET runtime library. http://en.csharp-online.net/Application_Architecture_in_Windows_Forms_2.0%E2%80%94Single-Instance_Detection_and_Management http://www.codeproject.com/csharp/SingleInstanceApplication.asp http://blogs.msdn.com/onoj/archive/2004/06/04/148532.aspx "Program.cs" below seems to work fine. A feature is it restores a...
13
5391
by: JohnQ | last post by:
Why would anyone write: class SomeThing // class littered with non-domain single-instancing code :( { private: SomeThing(); static SomeThing* pInstance_; public: static SomeThing* getInstance()
3
1720
by: sklett | last post by:
I suspect the answer might be in one of the words of my subject, but here goes anyway. I'm working on a system that will execute a very long (300+) chain of task objects. Here is some quick pseudo code to illustrate: public class VideoAcquisition { public Image GetFrame(){}; // other stuff
5
1699
by: Sarath | last post by:
I've to write a single instance class. there are different methods to control the single instance of a program. I've tried the following method class CSingleton { public: CSingleton& GetInstance(){ static CSingleton s; return s; } private:
0
10546
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10292
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.