Deploying Silverlight 3-Tier App to 1 Server

Deploying Silverlight 3-Tier App to 1 Server

Old forum URL: forums.lhotka.net/forums/t/7549.aspx


Gareth posted on Tuesday, September 01, 2009

Hi, I'm trying to deploy my Silverlight 3-Tier App to 1 server for testing purposes and I'm struggling to work out how to configure it.
I've created 2 web sites, one for the SL application (t2tdemo), and one for the application server (t2tappsrv).
I've copied the relevant files from Visual Studio into the directories.

I've also copied web.config into both directories (do I need it in both?)

I've modified the end point address in the t2tdemo website to point to the t2tappsrv web site.
I've modifed the sql connection string in t2tappsrv to point to the correct database.

When I run the app (t2tdemo) the Silverlight application loads correctly but when I do anything that needs to call a business object I get the following error:

Any ideas why?

---------------------------
Oops
---------------------------
An error has occured:

System.Reflection.TargetInvocationException: [Async_ExceptionOccurred]

Arguments:

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=System.dll&Key=Async_ExceptionOccurred ---> System.ServiceModel.CommunicationException: [CrossDomainError]

Arguments:http://localhost:1814/WcfSlPortal.svc

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=System.ServiceModel.dll&Key=CrossDomainError ---> System.Security.SecurityException ---> System.Security.SecurityException: [Arg_SecurityException]

Arguments:

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=mscorlib.dll&Key=Arg_SecurityException

at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)

at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState)

at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState)

--- End of inner exception stack trace ---

at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)

at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)

--- End of inner exception stack trace ---

at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)

at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)

at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)

at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndFetch(IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndFetch(IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.OnEndFetch(IAsyncResult result)

at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)

--- End of inner exception stack trace ---

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()

at Csla.WcfPortal.FetchCompletedEventArgs.get_Result()

at Csla.DataPortalClient.WcfProxy`1.proxy_FetchCompleted(Object sender, FetchCompletedEventArgs e)
---------------------------
OK
---------------------------

sergeyb replied on Tuesday, September 01, 2009

Because they are in different web sites, you need to configure policy file for Silverlight to allow it to call a service on a different web site. The changes need to occur on the web site that hosts WCF service, not on the one that hosts SL app.

http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx


Sergey Barskiy
Principal Consultant
office: 678.405.0687 | mobile: 404.388.1899

Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

-----Original Message-----
From: Gareth [mailto:cslanet@lhotka.net]
Sent: Tuesday, September 01, 2009 9:49 AM
To: Sergey Barskiy
Subject: [CSLA .NET] Deploying Silverlight 3-Tier App to 1 Server

Hi, I'm trying to deploy my Silverlight 3-Tier App to 1 server for testing purposes and I'm struggling to work out how to configure it.
I've created 2 web sites, one for the SL application (t2tdemo), and one for the application server (t2tappsrv).
I've copied the relevant files from Visual Studio into the directories.

I've also copied web.config into both directories (do I need it in both?)

I've modified the end point address in the t2tdemo website to point to the t2tappsrv web site.
I've modifed the sql connection string in t2tappsrv to point to the correct database.

When I run the app (t2tdemo) the Silverlight application loads correctly but when I do anything that needs to call a business object I get the following error:

Any ideas why?

---------------------------
Oops
---------------------------
An error has occured:

System.Reflection.TargetInvocationException: [Async_ExceptionOccurred]

Arguments:

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=System.dll&Key=Async_ExceptionOccurred ---> System.ServiceModel.CommunicationException: [CrossDomainError]

Arguments:http://localhost:1814/WcfSlPortal.svc

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=System.ServiceModel.dll&Key=CrossDomainError ---> System.Security.SecurityException ---> System.Security.SecurityException: [Arg_SecurityException]

Arguments:

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=mscorlib.dll&Key=Arg_SecurityException

at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)

at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState)

at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState)

--- End of inner exception stack trace ---

at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)

at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)

--- End of inner exception stack trace ---

at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)

at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)

at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)

at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndFetch(IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndFetch(IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.OnEndFetch(IAsyncResult result)

at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)

--- End of inner exception stack trace ---

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()

at Csla.WcfPortal.FetchCompletedEventArgs.get_Result()

at Csla.DataPortalClient.WcfProxy`1.proxy_FetchCompleted(Object sender, FetchCompletedEventArgs e)
---------------------------
OK
---------------------------

Gareth replied on Tuesday, September 01, 2009

Ok, that makes senses. I've added the cross domain policy files now. But I'm still getting a similar error (see below).

---------------------------
Oops
---------------------------
An error has occured:

System.Reflection.TargetInvocationException: [Async_ExceptionOccurred]

Arguments:

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=System.dll&Key=Async_ExceptionOccurred ---> System.ServiceModel.CommunicationException: [CrossDomainError]

Arguments:http://localhost:1814/WcfSlPortal.svc

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=System.ServiceModel.dll&Key=CrossDomainError ---> System.Security.SecurityException ---> System.Security.SecurityException: [Arg_SecurityException]

Arguments:

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=mscorlib.dll&Key=Arg_SecurityException

at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)

at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState)

at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState)

--- End of inner exception stack trace ---

at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)

at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)

--- End of inner exception stack trace ---

at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)

at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)

at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)

at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndFetch(IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndFetch(IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.OnEndFetch(IAsyncResult result)

at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)

--- End of inner exception stack trace ---

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()

at Csla.WcfPortal.FetchCompletedEventArgs.get_Result()

at Csla.DataPortalClient.WcfProxy`1.proxy_FetchCompleted(Object sender, FetchCompletedEventArgs e)
---------------------------
OK
---------------------------

Gareth replied on Tuesday, September 01, 2009

Just a thought, do I need to recompile the app with those files in the solution?

sergeyb replied on Tuesday, September 01, 2009

I think the policy file is not quite right still. It is pretty clear judging from the error.

Sergey Barskiy
Principal Consultant
office: 678.405.0687 | mobile: 404.388.1899

Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation


-----Original Message-----
From: Gareth [mailto:cslanet@lhotka.net]
Sent: Tuesday, September 01, 2009 12:08 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: Deploying Silverlight 3-Tier App to 1 Server

Ok, that makes senses. I've added the cross domain policy files now. But I'm still getting a similar error (see below).

---------------------------
Oops
---------------------------
An error has occured:

System.Reflection.TargetInvocationException: [Async_ExceptionOccurred]

Arguments:

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=System.dll&Key=Async_ExceptionOccurred ---> System.ServiceModel.CommunicationException: [CrossDomainError]

Arguments:http://localhost:1814/WcfSlPortal.svc

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=System.ServiceModel.dll&Key=CrossDomainError ---> System.Security.SecurityException ---> System.Security.SecurityException: [Arg_SecurityException]

Arguments:

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.40723.0&File=mscorlib.dll&Key=Arg_SecurityException

at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)

at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState)

at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState)

--- End of inner exception stack trace ---

at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)

at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)

--- End of inner exception stack trace ---

at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)

at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)

at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)

at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndFetch(IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndFetch(IAsyncResult result)

at Csla.WcfPortal.WcfPortalClient.OnEndFetch(IAsyncResult result)

at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)

--- End of inner exception stack trace ---

at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()

at Csla.WcfPortal.FetchCompletedEventArgs.get_Result()

at Csla.DataPortalClient.WcfProxy`1.proxy_FetchCompleted(Object sender, FetchCompletedEventArgs e)
---------------------------
OK
---------------------------

Copyright (c) Marimer LLC