TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Satya Pratap Danda
NA
10
2.6k
Clarification needed about WCF Concurrency in REST Services
Sep 4 2013 3:38 AM
hi all,
I have created WCF Rest services. When i am hitting the same request continuously from client(i.e from Android mobile) it is using diifrerent threads and thread.sleep is also not working.
My code is below like this..
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class Service1 : IService1
{
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "VerifyLogin")]
public bool VerifyLogin(Login loginCred)
{
bool res = false;
string strThreadPrint= "";
try
{
strThreadPrint= Thread.CurrentThread.ManagedThreadId.ToString() + " time at : "+DateTime.Now;
Thread.Sleep(5000);
dbcon = new DBConnection();
//for testing here i am throwing an exception so that its going to catch block and responce sent back to client with exception details as shown in catch block.
dbcon.VerifyLogin(loginCred.Username.Trim(), loginCred.Password.Trim());
}
catch (Exception sqlex)
{
objErrorClass = new ErrorClass("Login class", sqlex.Message + " --- " + strThreadPrint, "CNMK");
throw new WebFaultException<ErrorClass>(objErrorClass, System.Net.HttpStatusCode.BadRequest);
}
}
}
when i am sending request using fiddler with following Requestbody {"Username":"13","Password":"dgdf"}
At that time i am getting the responce as in Json format
{"ErrorDesc":"login failed --- 33 time at :09/04/2013 12:31:30"}
{"ErrorDesc":"login failed --- 35 time at :09/04/2013 12:31:30"}
{"ErrorDesc":"login failed --- 41 time at :09/04/2013 12:31:30"}
{"ErrorDesc":"login failed --- 45 time at :09/04/2013 12:31:30"}
So the instance mode and concurrency mode not working for wcf restful services????
or am i doing any wrong in my code?? please help me
Reply
Answers (
0
)
WCF host doesn't work on Windows server 2003 using SSL
Can somebody help me, please tell about MTOM