Reputation: 1171
I have two wcf services with the same interface hosted in IIS using http binding. Both have only three methods:
OpenFile(userid)
which creates or opens userid.txt.
Write(userid, X)
which writes X into the file
Close(userid)
which closes the file
InstanceContextMode =InstanceContextMode.PerSession
is used for Service B.
Service A:
Is it stateless (service technically does not need to remember the user id, it's tracked by the client) or stateful (the service operation is like a state machine. Client must call the methods in a particular order)?
If HTTPS binding is used, is it stateful?
Service B:
I guess a more general question is whether the statefulness of the web service depends on how it's designed and implemented or how it is hosted? Is there like a "checklist" that I can go through to determine if my web service is categorize as stateless or stateful?
Thanks
Upvotes: 1
Views: 1105
Reputation: 57169
By default, anything over HTTP is stateless. When you use PerSession, it still depends on whether your web service implementations use Sessions. But whatever the case, your web server remains stateless, which is precisely while you retain state in a special object (Cache, File, Database or Session).
Even a Session is stateless: unless the server sends the cookie in the HTTP request, nothing is remembered between requests.
This doesn't change for HTTPS. While it is a completely different protocol, the statefulness doesn't change.
About your checklist: it will be short, as it is always stateless with HTTP. Whether or not an implementation maintains state doesn't change this. It's up to the implementation how to work around this limitation and to maintain state, you cannot "see" that on the outside.
Upvotes: 2