views:

39

answers:

0

Trying to use SecurityAction.RequestOptional (recommended as a best practice in a study guide for exam 70-536), and running into problems.

My understanding of RequestOptional is that if you use it, you must explicitly declare all other permissions your app will use. From the MSDN:

The RequestOptional flag enables you to request a set of permissions while 
implicitly refusing all other permissions that the runtime otherwise might 
be willing to give.
... 
You must use the RequestMinimum flag to identify permissions that you must
have in addition to the optional permissions you identify with the 
RequestOptional flag

So I've explicitly set all other permissions I think my app will need using SecurityAction.RequestMinimum. But now the app throws exceptions when I run it, so I'm missing something. The exceptions themselves are unhelpful in determining what exactly that would be.

I suspect the problem lies within the enterprise library, that it is trying to do something I haven't explicitly permitted (the app runs as a windows service that spawns a new thread to listen on a socket on startup, so debugging before I hit the exception is difficult).

How do you determine permissions your app will require so that you can explicitly request them? Especially when using third-party components?