Paweł Poręba
Paweł Poręba

Reputation: 1105

wcf and isolated storage- needed explanation

I have some thoughts in my head and I would like to put them in a proper shelfs, but in a general approach, to be able to spread my knowledge in the future.

So, suppose I'm running the WCF service that contains two methods: one that sends list of some objects to the client (when the client demands to) and the second one that changes state of the object based on the client's actions. Those objects that are send through the WCF are stored in a isolated storage on the service side.

Now, let me group my questions:

1) Firstly, I'm wondering what happens if many of clients would add my service as service refference. As this service is using isolated storage (let's say I'm usings storing for assembly), what would happen if many of the clients wanted to change the data simultaneously? I mean, how does isolated storage works here, does it generate different file for every client (meaning it's safe for many users, cause every of them is manipulating the different file)? Because if it's stored on the server side, then I suppose it's one file for everybody.. Or maybe I can decide by myself configurating isolated storage or the server itself? If yes, how?

2) Supposing, this file is common for every single client. Then I must provide some locking/unlocking logic. Is there something special about this concerning WCF? Can u provide any good articles about that matter?

Upvotes: 1

Views: 109

Answers (1)

user8128167
user8128167

Reputation: 7686

With Isolated Storage files are separated by user and assembly, so in your case it is IUSR_machine unless you use impersonation. So you would need to implement file locking/unlocking. Why can't you use a SQL database as your storage?

UPDATE:

Impersonation basically allows your process to run in a different security context than the process that owns the thread. From https://msdn.microsoft.com/en-us/library/ms730088(v=vs.110).aspx

Typically, clients call a service to have the service perform some action on the client’s behalf. Impersonation allows the service to act as the client while performing the action.

See also http://blogs.msdn.com/b/saurabs/archive/2012/07/16/wcf-learning-impersonation.aspx

You basically put something like this into your config file:

<serviceAuthorization impersonateCallerForAllOperations="true" />

Upvotes: 1

Related Questions