Silverlight Application Compile Failed in Visual Studio 2013 part 2

We had a post about “Silverlight application compile failed in Visual Studio 2013”, but this time after we did the steps which was introduced, we still got compile failed.

We tried to moved current Silverlight application to another pc which was installed visual studio 2013, we found there were some references gone.

We tried to use NuGet manager and installed some packages but still not work. so what we did was just add those missed reference (dll files) manually in Visual Studio 2013.

Continue reading “Silverlight Application Compile Failed in Visual Studio 2013 part 2”

How about no more Silverlight 6 ?

I am considering what solution will be a good replacing solution if Microsoft really no more have new Silverlight edition like Silverlight 6, I tried using JavaScript way (or JavaScript library such as jQuery) and found for non-small data realtime data, JavaScript solution is worse than Silverlight solutions.

But, is there really no better solution if we do not use Silverlight? we will not choose flash because if we will not use Silverlight why we should use similar tech solution?

Continue reading “How about no more Silverlight 6 ?”

Silverlight 4 or 5 Application Supports Multiple Languages (Localize)

Silverlight can use resource to support multiple languages. We do not talk about the regular steps which how to use resource files.

Here we have to know there is additional step to do in Silverlight 4 or 5, at least in Visual Studio 2010 (We did not try Visual Studio 2012 and Visual Studio 2013):

Continue reading “Silverlight 4 or 5 Application Supports Multiple Languages (Localize)”

Silverlight Application Compile Failed in Visual Studio 2013

We had an ASP.NET project using Silverlight and WCF which developed in Visual Studio 2010 and Visual Studio 2012, both versions worked without any problems.

From this year we tried migrate the ASP.NET project to Visual Studio 2013 since there are new features we can use in Visual Studio 2013, however, we could not compile the project, the compile errors came from Silverlight sub project, which all were about the service reference did not include methods, which meant the Silverlight application could not load WCF service, even we removed the web service reference and rebuilt still not worked, also, there were other errors message indicated Silverlight application could not find some libraries.

Continue reading “Silverlight Application Compile Failed in Visual Studio 2013”

Summary of Deploy WCF, Silverlight and ASP.NET

We posted 3 guides about Deploy a web application which includes WCF, SilverLight and ASP.NET , for simplified all steps, here provides a “quick guide”:

1: Make sure you have installed IIS successfully, at least you can visit http://localhost and see a default web page;

2: Open IIS Management (7 and above), right mouse click Sites\Default Web Site and choose “Add Virtual Directory”, here we create a virtual directory using a physical Widows path (you can make a new path here such as C:\ConspecWeb without leaving away IIS management tool), and give an alias name such as ConspecWeb;

3: Right mouse click the virtual directory that you just created in step 2, and choose Add Application, here we create a web application, we choose another physical path or create a new path, normally we will create a new sub path under the path that we created in step 2, for example: C:\ConspecWeb\WebTerminal, we give an alias name WebTerminal, and select Application Pool as ASP.NET 4.0;

4: Now copy the Website files (not WCF service files)  to C:\ConspecWeb\WebTerminal folder, and try to visit http:/localhost/ConspecWeb/WebTerminal, you should see the website home page (but just Silverlight page do not work since we have not set WCF yet), if no, then there must be some error places which you have not set correctly;

5: Go to the folder which you put the WCF service files, open the web config file, if your WCF hosted in a Windows application, the config file name should like  xxxx.exe.config; scroll down to Services section, most of content have already set for us, we just need to change the endpoint address to our real address:

— First, we set baseAddress as our WCF service root path, for our case, it is;

— We have an endpoint for Client Access Policy file for the cross domain handling for Silverlight application, the address should be empty, means it uses the base address which we set above;

— We have basicHttpBinding endpoint to provide services to Silverlight clients, the endpoint address we set to “SL/”;

— endpoint for Meta Data Exchange, we set to “SL/mex

so the final endpoint addresses will be set like following:

      <service name="ServiceApp.Services.TerminalService" behaviorConfiguration="TerminalServiceBehavior" >
        <endpoint address="" behaviorConfiguration="webHttpBehavior" binding="webHttpBinding" bindingConfiguration="" name="PolicyEndpoint" contract="ServiceApp.Services.IClientAccessPolicy" />
        <endpoint address="SL/" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ConspecService" contract="ServiceApp.Services.ITerminalService"   name="TerminalServiceSLEndPoint"/>
        <endpoint address="SL/mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <add baseAddress="" />


Sometimes when you use “localhost” and use another port number which is not 80, you might use the config similar with the following:

      <service name="CCService.Services.CCServices">
        <endpoint address="http://localhost:8732/" behaviorConfiguration="webHttpBehavior" binding="webHttpBinding" bindingConfiguration="" name="PolicyEndpoint" contract="CCService.Services.IClientAccessPolicy" />
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ConspecService" contract="CCService.Services.ICCServices"   name="TerminalServiceSLEndPoint"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <add baseAddress="http://localhost:8732/MyServiceAddress/CCServices/" />

after you done above, please try to visit the service URL, you should see the service information, if you can not see, there must be some wrong you have not set correctly yet;

6:  Now set website Silverlight client, the process will be same as the description here; all other left steps also can be found in previous 3 blogs which we have posted.

Silverlight and Socket Samples

We know Silverlight needs a limit range of Port number 4502 ~ 4534, and Port 943 for security policy.

But in Silverlight 4, the security policy file can be downloaded via either TCP port 943 or HTTP (port 80);

so here we found 2 great samples for using port 943 and not using port 943:

1: In this page, check the last 2 links: Pushing Data to a Silverlight Client with Socket I and II, this is for using Port 943;

2: Silverlight 4: Silverlight 4 RC – Socket Security Changes

Silverlight and Socket Links

1: HTTP Communication and Security with Silverlight (including Cross-Domain Communication)

2: How to: Specify Browser or Client HTTP Handling

3: Network Security Access Restrictions in Silverlight

Silverlight supports two types of security policy files:
   — Flash policy file -  crossdomain.xml policy file used by Adobe Flash. 
   — Silverlight policy file -  clientaccesspolicy.xml file used by Silverlight

In Silverlight 3, the Silverlight runtime tries to open a connection using TCP to a well-known port (port 943) on the target site. If a TCP connection can be established, the Silverlight runtime sends the special string <policy-file-request/> to the server to request a Silverlight socket policy file. The Silverlight runtime then waits to receive a reply from the target site that contains a Silverlight policy file.

In Silverlight 4, an application can choose instead to retrieve the policy file via the HTTP protocol on TCP port 80 instead of the custom TCP protocol on port 943. This allows HTTP servers that are already running HTTP services to authorize socket connections from Silverlight applications without having to deploy a new TCP service on the machine and open a port through a firewall for port 943.

To deploy a socket policy file on a server for sockets in Silverlight 3, system administrators need to configure a separate authentication service on port 943 for each IP address that is to provide the policy file definition.

To deploy a policy file on a server for sockets in Silverlight 4, system administrators can choose to use the above method on port 943 or use HTTP port 80. For use with HTTP, system administrators need to configure a web service for each IP address that is to provide the policy file definition and make the Silverlight policy file available over HTTP. The policy file for sockets must be stored in the "clientaccesspolicy.xml" file at the root of a web server that responds for the resolved IP address of the target connection request. …

4: Silverlight Socket Class

5: Silverlight working with Socket

6:  Pushing Data to a Silverlight Client with Sockets: Part I (Silverlight 2)

7: Pushing Data to a Silverlight Client with Sockets: Part II (Silverlight 2)

A Case: Deploy a web application which includes WCF, Silverlight and ASP.NET part 3

I posted the previous 2 parts of our case deployment in 2012:

1: A Case: Deploy a web application which includes WCF, Silverlight and ASP.NET part 1;
2: A Case: Deploy a web application which includes WCF, Silverlight and ASP.NET part 2;

Today I post the 3rd part: Deploy the case on a server which installed Windows Server 2008 R2.

The main point which we should be very careful is the different between in cases of you deploy the ASP.NET with Silverlight on Windows Server and on Windows XP / Windows 7, which is that we should consider more security settings on Windows Server version, it means we might never met some troubles on Windows 7 but they are normal on Windows Server.

OK, let us check the first problem: if you deploy the case on Windows server, when you done all steps which were mentioned in previous 2 posts, you will find all Silverlight web page still not work, for example, you will only see the empty page, not any Silverlight page content display.

The reason is about Security.

In previous part 2, after you unzip SLApp.xap, and changed Silverlight Client side configuration file, and zipped whole folder files into a new file, The Windows Server system actually changed the file security information, this is the big difference with when you do the same procedure in Windows 7.

Please check the following screen shot, the new file has a different icon with old SLApp.xap file.


Right click the file and check the properties, click Security tab, you can see the different security settings:

image  image

So now we now the new zipped file missed some security information. Let us just add missed group or user names which are IIS_IUSRS, Usuarios and TrustedInstaller, you might not have to add all missed roles, for example, you might ONLY need to add the IIS_IUSRS user. (In our case, we added IIS_IUSRS and Usuarios)

After you added missed security information, you will see the web page visiting works again.

A Case: Deploy a web application which includes WCF, Silverlight and ASP.NET part 2

About our case’s deployment, I have posted the part 1 here. This article is the part 2.

We have done the discuss for Web Server settings and WCF configuration. Here we start from the 3rd part: Silverlight project configuration.

C> Silverlight project:

The Silverlight project or application also need to be set since it communicates with WCF services. you have to specify your right WCF service URL to Silverlight project or application. However, our smart Microsoft does NOT provide a similar config file with WCF or other applications, there is NOT a configuration file for Silverlight. All configuration information were involved in a binary file, which is a .xap file, Normally, you can find it under ClientBin folder.


So what you should do is try to find a way to change the config information in this .xap file. There are also some solutions on the internet to tell programmer to use other ways to set information for Silverlight application, but by now I have not found a ideal solution. Maybe we need to research more about this.

OK, let us come back to try to set for Silverlight. actually, the way is simple, the .xap file is actually a compress file, it is a true .zip file !, so, my friend, the magic is here! Haha… Just change the extension name .xap to .zip (or for more safe, just like me, copy the .xap file to a .zip file), and unzip using your normal way to expand it. 


Bingo! now you can see the expanded folder which includes lots of secret files!


What we need to care about is the ServiceReferences.ClientConfig file only, so we can ignore all other files here. Please use any text edit tool such as notepad to open this file, you can see the content is like the following:


Now I think smart you know what should do, yes, just use a correct WCF service address to replace the above green box wrapped content, our case is which mentioned in part 1. and save it. and close the editor tool.

OK, you fixed the Silverlight configuration, one more step: please DO NOT forget to recover the .xap file

What we should do is just compress all the folder to a zip file again. and change the extension name to .xap file, that is.! But, please DO NOT compress the files out side of the files’ folder, but inside the folder please! so that you can get a compress file which does not include the folder itself. otherwise your .xap file will not work.

Maybe I need to teach you more details here even though it is a very simple step:

Make sure you are inside of the files’ folder; and choose all files in this folder, and then right mouse, choose a compress way due to your compress tools installed, for Windows 7, you just simply choose “send to” a compress file.  Again: you should make sure you are inside the folder, so that the generated zip file will NOT include the folder itself. This is also very important!


Finally, Change your .zip file to .xap file using the original file name. that is! The configuration for Silverlight done!

D> Website Project:

The most simple part is website in our case, we do not need any configuration for our website project since most of settings have already done on previous projects.

All we need to do is copy all web files including Silverlight project content (Web developer should prepare a complete website deployment package first. the package include website and Silverlight project,  you should do the Silverlight part configuration just like what I told above), We should copy the content to the virtual folder on IIS web server which we created in the part 1, in our case, the URL is:

If you have finished all configuration successfully, and you have started the WCF Service, and you have copy all website files on IIS web server, now you should be able to visit your website.

Let me leave for other stuff. I might come back for more support information, in case of I find more.

Good luck!