0
votes

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.

1
Sounds like a cross-domain issue. Silverlight by its very nature is browser to browser and each site/service called should be allowed by setting up a config file.ΩmegaMan
@ΩmegaMan what do you mean by "cross-domain issue." What do I have wrong? Is there some setting somewhere I need to look at?Tom Regan
Making a Service Available Across Domain Boundaries … ahhh brings back memories. :-)ΩmegaMan
@ΩmegaMan thank you, but I'm afraid that link refers to Silverlight 4. In any case this application has been working for years, and I'm not making any cross domain calls.Tom Regan
Silverlight 4/5 have cross domain issues. But the silverlight app is running in a client browser. To get data, it has to make a call to a service (not in the web page right) to an external service. That by its nature is a cross domain call. If you say its not the issue, I take you at your word. My thought is once you changed servers, the location of the approved sites for cross domain changed with a new service location. If nothing else look at the config files as mentioned in the article and verify that the cross domain calls are allowed.ΩmegaMan

1 Answers

2
votes

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