asp.netsilverlightsilverlight-5.0

Silverlight 5.1 app breaks when moved to new server


I inherited a Silverlight 5.1 asp.net application which has been running successfully on a Windows 2008 R2 server running IIS 7 for many years. I've been tasked with moving this application to a Windows Server 2016 Standard machine with IIS 10.

I installed Silverlight 5.1 (client) and the Silverlight 5.0 sdk on the Windows 2016 machine but otherwise made no changes. The machine has Framework 4.7.2. Several other asp.net applications are hosted on this server, but this is the first Silverlight application.

I tried simply copying the old application to the new server, and also rebuilding and publishing the application from the source code to the new server. I've tried running under both http and https. In all cases I get the error as described below.

When I navigate to the application using IE 11 with the Silverlight plugin installed I get a popup, "Load operation failed for query 'GetUser'. [HttpWebRequest_WebException_remoteServer] Arguments: NotFound..." and etc.

Nothing is logged that can be seen in the Windows event viewer.

Using Fiddler I can see that the browser is making this call first and getting a 404 Not Found error:

Looking in the source code I see there is a class named "AuthenticationService", which derives from System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase, which in turn has a GetUser method. I can also see the file PMSys.Client.xap in my "ClientBin" folder. I assume some Silverlight magic inside PMSys.Client.xap creates the path http://xxx.xxx.xxx.xxx/ClientBin/PMSys-Client-Web-AuthenticationService.svc/binary/GetUser.

Using the same instance of IE 11 and Fiddler, but calling the old, successful machine, I notice that it gets Silverlight.js first, and then makes the same call to ...binary/GetUser. On the new, failing machine there is no call to get Silverlight.js. I assume this is a clue.

I can run this application in debug mode in Visual Studio 2017 on my local machine. The App.xaml.cs file contains a method "Application_Startup". This method calls WebContext.Current.Authentication.LoadUser(), which in turn calls this bit of code:

public EntityQuery<User> GetUserQuery()
    {
        this.ValidateMethod("GetUserQuery", null);
        return base.CreateQuery<User>("GetUser", null, false, false);
    }

This works on my local machine. I assume this is the "GetUser" call that is failing when I visit the application on my 2016 server; my understanding of Silverlight is that this "GetUser" call is made by the Silverlight runtime in the browser to the server.

My question is, what am I missing in my setup that is causing the 404 error? Why does the old, successful application load Silverlight.js, but the new, failing application does not?

This seems to be a server-side problem. If I paste the path http://xxx.xxx.xxx.xxx/ClientBin/PMSys-Client-Web-AuthenticationService.svc/binary/GetUser into a browser address bar I get a 404 error when I hit the new, failing site. For some reason IIS is simply not serving up Silverlight stuff. But if I pass that same path to my old, working application I get the usual browser prompt, "what do you want to use to open this file," and the result of the call streams down to me.

On both the new (failing) and old (working) sites, if I paste the path of the referer, http://xxx.xxx.xxx.xxx/ClientBin/PMSys.Client.xap, into the browser address bar I get the usual prompt, "what do you want to use to open this file."

I've checked every IIS setting comparing the old site to the new site and they are in agreement, including "Full Trust" and the existence of the .xap, .xbap and .xaml mime types.

Does something else need to be installed on my server in addition to Silverlight 5.1 and the 5.0 SDK?

I've seen several posts about installing RIA Services, but this appears to be a Silverlight 4 issue. RIA services are not installed on the old, Windows 2008 machine and the application is running successfully there. From what I've intuited RIA services need to be installed on the development machine in order to reference the "System.ServiceModel.DomainServices" libraries, but these become part of the deployment in Silverlight 5, so there is no need to install RIA services on the web server. I have confirmed that these libraries are in the deployment.


Solution

  • The answer is to enable HTTP Activation for the WCF Services under the Add Roles and Features Wizard, see this SO answer