Silverlight trying to access local crossdomainpolicy.xml - silverlight

I have a Silverlight app that I developed locally, and I'm trying to run it on a Windows 2008 R2 server that I personally setup. Everything smooth and dandy, except that when I try to auth on the app, it tries to look locally for
http://localhost/crossdomainpolicy.xml
http://localhost/clientaccesspolicy.xml
It also throws a nasty error :
Uncaught Error: Unhandled Error in Silverlight Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at SomeService.MVServiceReference.CheckUserCompletedEventArgs.get_Result()
at SomeService.Pagini.Autentificare.AuthForm.webServiceSoapClient_CheckUserCompleted(Object sender, CheckUserCompletedEventArgs e)
at SomeService.MVServiceReference.MVWebServiceSoapClient.OnCheckUserCompleted(Object state)

If your XAP file is on http://localhost/somewhere/somefile.xap it shouldn't look for a clientaccesspolicy. Are you using the ASP.NET dev. server to host the Silverlight app while you are using IIS for a WCF service that is called by the silverlight app?
Silverlight's inability to present exception details is well known. It is due to the fact that all communication from a Silverlight component to a service utilizes the hosting browser and when there is an error returned with a http error code, the browser only returns the error code and not the message containing the exception details to silverlight.
Activate WCF trace logging on the server side and look in the svc-log to get the real exception message.

For crossdomain purposes, http://localhost/ , http://localhost:1234/ and http://localhost:4321/ are all different domains.

Related

SignalR IIS With React - "Server returned handshake error: Handshake was canceled."

I am developing a .Net Core (3.1) web application hosted with IIS 10. When I am trying to use SignalR on localhost, I am able to connect totally fine and receive messages from the backend, but after I publish it to IIS, I get the error: "Server returned handshake error: Handshake was canceled." In the client logs on Chrome's console, I get the message: "Information: SSE connected to http://myserver.com/MyApplication/output" before I get the error described above (which you would think means that I connected successfully)...
I have seen other posts where people have suggested that I have to enable webSockets on IIS, and I have already checked the my site has this enabled.
I have also seen people suggest to try using the longPolling argument in the withUrl function when creating the connection, and this has not helped either.
I have also added SignalR Event Log Trace Listeners to my web.config file, and the only warning I get that might be related to this issue is that I get a warning from the .NET runtime that reads "Failed to determine the https port for redirect." I am not sure what this means or if it would be related to SignalR, but as this also appears to deal with Middleware, it might be significant.
One thing that I thought might be related is that my site is just one of multiple hosted on this server, so that when I am running locally, I can use the following to connect to SignalR:
hubConnection = new signalR.HubConnectionBuilder().withUrl("/output").build();
But because of the way this site is deployed on my server, I have to use this:
hubConnection = new signalR.HubConnectionBuilder().withUrl("/MyApplication/output").build();
when I deploy the site or else I get a 404 error...
Would there be any issue there? I noticed when inspecting the network requests that on localhost, the URL to connect with the socket is "wss://localhost:44315/output?id=..." and I get the "Status Code: 101 Switching Protocols", but after I deploy, the url that is used is "http://myserver.com/MyApplication/output?id=..." and I get a "200 OK" just before receiving the error described at the top. Why does wss get used on localhost but http is requested from my client when I deploy?
FINALLY discovered the issue after days of debugging... The reason I was getting a "101" response on localhost and not when published is because 101 is basically the server (IIS in my case) saying "I support web sockets". I realized that because I wasn't getting this when published, web sockets were probably not enabled in IIS. It was weird, however, because I went into IIS manager and it said that web sockets were enabled, but after much more research, I found that you also have to go into "Server Manager" and enable it as well (see here https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support and follow step by step instructions). I did not realize both were required.

RIA Domainservice - Notfound error - how to get more debug information?

I'm having problems to find enough information to figure out what's missing on my published Silverlight application.
Running the applicaton locally (but with the db connectionstring to the "live" database), everything is running fine.
However, when I try to run at the published remote site it fails. It seems to be related to the db connection, but I don't get any detailed error from the server.
I've added a "debug" code at RIA service completed method
if (myLoadOperation.HasError)
{
MessageBox.Show(myLoadOperation.Error.Message);
MessageBox.Show(myLoadOperation.Error.InnerException.ToString());
}
The messagebox displays:
Load operation fail for the query 'GetData'. The remote server returned an error : NotFound
What is not found??!?
Additional information I get from JIT Debugger (VS2010)
NotFound. at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
I suspect that it might be a dll related to EF or RIA which may be missing on the remote server, but I'm not quite sure how to identify what's wrong. It's a shared hosting environment.
Could it be located to the MySQL provider?
connectionString="metadata=res://*/Model.Model1.csdl|res://*/Model.Model1.ssdl|res://*/Model.Model1.msl;provider=MySql.Data.MySqlClient;provider connection string="server=xxxxxxxxx;User Id=xxxxxxx;password=xxxxxxxxx;Persist Security Info=True;Allow Zero Datetime=True;Convert Zero Datetime=true;database=xxxxxxxxxx;" providerName="System.Data.EntityClient"
I've uploaded the following dll's to the server's bin folder:
System.ServiceModel.DomainServices.EntityFramework.dll
System.ServiceModel.DomainServices.Hosting.dll
System.ServiceModel.DomainServices.Hosting.OData.dll
System.ServiceModel.DomainServices.Hosting.Server.dll
I found the blog post WCF RIA Services - “Not Found” Error Message to offer several methods of debugging this very generic error message. Using tools like Fiddler and WCF Binary-encoded Message Inspector for Fiddler should give you a better understanding of what the real error message is.

WCF error with hosting of a SL4 Navigation application

I have a SL navigation application, that currently runs on a shared hosting package with a 3rd party ISP. I can login, and register using the ASP.NET membership and role providers.
I have now setup a dedicated server, on which only my app will run. It does not yet have a domain name that points to it... I access it via an IP address.
I've copied the entire site (including the ClientBin and all the XAP's) to the new server, but the Authentication and Registration services don't work... they just return NotFound.
When I check Fiddler on the working site, this service is called :
www.myaddress.com/ClientBin/MyApp-Web-AuthenticationService.svc/binary/Login
which of course succeeds. However, on the other site, the fiddler trace looks the same (because I just copied the site) :
123.123.123.123/ClientBin/MyApp-Web-AuthenticationService.svc/binary/Login
but, the call fails with NotFound. Fiddler reports it as HTTP/1.1 500 Internal Server Error. When I open
http://localhost/ClientBin/MyApp-Web-AuthenticationService.svc/binary/Login
on the server, I get the HTTP/1.1 500, as well as this description :
Handler "svc-Integrated" has a bad module "ManagedPipelineHandler" in its module list
Which leads me to believe that there is something wrong with my IIS config, as the exact same code is working on another system.
What is a "bad module"? How do I fix it?
Normally this type of error is that ASP.Net is not activated or that a handler for svc is not registered or registered correctly.
In your case is looks a bit different. It could be that you have .net framework 4.0 code that you are trying to run in a .net framework 2.0 application pool.
IIS 500 errors often show up with more information in the Windows Event log - if you can somehow get access to that?
Also I've noticed that often the server will actually send debugging output back to the client that everything seems to ignore. Have you checked the entire raw response that is coming back from the server to see if there are any clues there?

Silverlight WCF service calling exception

A Silverlight 3.0 application tries to call WCF service but the application can not even establish connection to the endpoint. I had checked URLs etc. and every thing seems ok. Accessing the service from other tools like browser works. When I debug application in Visual Studio when the first call to the service is made below output is dumped:
'sllauncher.exe' (Silverlight): Loaded 'C:\Program Files\Microsoft Silverlight\4.0.50401.0\System.ServiceModel.dll'
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
When the above error happens, application starts to wait until timeout.
Also Silverlight application is Out of Browser one with elevated permissions set to true so no need for crossdomain.xml.
I wonder if the above System.IO.FileNotFoundException can be detailed by doing something? Or may be you may have come up with this problem.
Thanks anyway.
It was an issue of calling WCF service from a high level at App.xaml.cs, the problem is gone when called from MainPage.xaml.cs.

Silverlight error message [Arg_VersionString]. Don't know where to begin

One of the users of a silverlight app I wrote gets this error message:
[Arg_VersionString] 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=4.0.50524.0&File=mscorlib.dll&Key=Arg_VersionString
I checked the log of the asp.net application that is hosting the silverlight plugin and I see no exceptions. The services seem to be working properly, I even witness the trace of this user running the app, and I can confirm that the service successfully returned data.
Something must be happening on the client side, but I don't know where to start. The software is in production already, there are no debugging tools on that server other than DbgView and the problem only seems to be occuring for this particular user.
What would you do?
In order to reduce the size of the Silverlight plugin, The strings of error messages were removed. So if any unhandled exception gets thrown this is the message you will recieve.
In order to get the full version of the exception the user has to have the Silverlight Developer Runtime and not the client runtime installed.
If you have a record of the data returned to the client, you might try using Fiddler to inject that data into the client running on your machine and see if it fails. If it does you should get back the full error message.

Resources