Click here to Skip to main content
15,845,436 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created manually my logging method to log some web-methods inputs in my soap web service created on visual 2010 vb.net. As my webservice will be accessed by multiple users I have thought of lock method that locks each time the log-file. But I faced a big issue: when multiple clients submit at the same time, the lock is stopping the submit for a while for some of them until file is unlocked ... That's why I created my logging method in a thread that works in background of each logged webmethod to avoid clients to wait in queue until file is locked and unlocked again by each other. Now my question is: If a webmethod has finished working, but the thread is still waiting the file to be unlocked, does it still work? In other words: Does my thread still could save inputs to be written in my logFile even if its webMethod has finished and another webmethod was called? Here is an example of my code:

VB
<webmethod()> _
    Public Function Test(ByVal strLang As String) As String()

        Dim obAr(0) As Object
        obAr.SetValue(strLang, 0)

        '' MyLogger is a class where I added SyncLock to my write method
        Dim MyLogger As New MyLogger(obAr)

        '' here I implemented a thread for my write method to work in background        
        Dim t As New Thread(AddressOf MyLogger.Write)
        t.Start()

        ''Here I am connecting to my database to work with data ...
        cnnString =     ConfigurationManager.ConnectionStrings("connStringMobileApp").ConnectionString
        Dim cnnConnection As New SqlConnection(cnnString)

....
End Function


What I have tried:

1- Soap extension: not working when two clients are trying to submit at the same time
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900