0

I have developed a Silverlight Business Application using Prism that requires a user to log in before they can access the main application. The Silverlight application is hosted on IIS 7.5 (port *:8086) and makes calls to WCF services hosted on the same instance of IIS 7.5 (port *:8069)

When I access the Silverlight application via http://localhost:8086 all works as expected (i.e. after successful authentication, prism modules are loaded and views switched appropriately) but when I access it via either the machine's name (http://xps1521-pc:8086) or IP address (http://192.168.10.104:8086), it does not work as expected (i.e. after successful authentication, prism modules are loaded BUT views are not switched). I cannot seem to figure out why this is happening and would appreciate some help/guidance.

Thanks!

Izmoto
  • 1,939
  • 2
  • 17
  • 21

2 Answers2

1

After close inspection of the exception you submitted, I think this is the problem.

most probably you're using some sort of reflection code (or opening a UI Dialog) in your ViewModel subscription handler that can only be executed when Silverlight runs in Full Trust Mode.

So when the URL of the silverilght application changes from something besides localhost (your dev server) , it doesn't run in Full Trust Mode anymore, that's why you get that exception.

You have to check if you're are executing any method call with the attribute [SecurityCritical]. If so and if you really need to execute that method than you have to run the Silverlight client in Full Trust mode (not recommended since this should only be feasible for intranet scenarios).

See this for more info

Hope it helps

tmoreira
  • 124
  • 3
  • thanks for your input. It is most likely a security issue. I have no reservations about Full Trust Mode because the said Silverlight application is meant to be run in an intranet environment only. – Izmoto Aug 27 '13 at 06:14
  • If you post the code that is being executed in your event handler, I can have a closer look at it. – tmoreira Aug 27 '13 at 18:42
  • From http://msdn.microsoft.com/en-us/library/ff921131(PandP.20).aspx - I learnt that *Silverlight does not support weak references to lambda expressions or anonymous delegates. For Silverlight, you need to call a separate method.* The exception was being raised when I use the Prism EventAggregator with a lambda expression and by using a separate method, the exception is not being raised anymore. – Izmoto Aug 28 '13 at 09:59
0

I have traced my woes to a MethodAccessException as described here

Community
  • 1
  • 1
Izmoto
  • 1,939
  • 2
  • 17
  • 21