How to troubleshoot Silverlight RIA Applications

It’s difficult to troubleshoot Silverlight applications built with WCF RIA services on a production environment because:

1) RIA Domain services is a virtual file and you will not find it in the directory structure.
2) Any exception thrown by the domain service will NOT be shown on the Silverlight client.  It will only show up as a 404 Not found error.  Without the real error, it’s very difficult to troubleshoot the problem.

In this post, I’m going to show you how to get the real error returned by the RIA domain service.

In this example, I am using the HR Application sample downloaded from Microsoft.  With the Silverlight application, all I am seeing is the Not Found error which is not very helpful.



To get the real error returned by the domain service, you will need to install the HTTP Debugging Proxy tool, Fiddler.

Once you have Fiddler installed, you can fire up a Fiddler session and start capturing the HTTP requests.

In the Fiddler trace below, you can see that the request made to the domain service, /riarc2test/ClientBin/HRApp-Web-AuthenticationService.svc/binary/GetUser, returned a 500 error.  In the web view on the right hand pane, Fiddler will display the real error returned by the domain service.


Also note that /riarc2test/ClientBin/HRApp-Web-AuthenticationService.svc does not exist on the server but you’ll get the same error if you browse to this URL.

Frank Cheung
CTO

The Falafel Software Team in their Training Room

I met the CEO and staff from one of our partners, Falafel Software, at a couple of past conferences and they told me about their training classroom in Capitola, CA near Santa Cruz. They told me they would display a DiscountASP.NET banner up on the wall if they had one. So we had one made and sent it to them.

Falafel Software recently sent me a team picture in their training room. The picture is great and I want to give them a big thanks for our partnership.


If you are not familiar with Falafel Software, they are a .NET consulting and training company with expertise in the latest Microsoft technologies including .NET 4 and Silverlight 4. For training, they provide in-class, on-premise and online training courses. They are deep partners with Telerik and offer standard and advanced classes for Telerik Sitefinity CMS. In fact, they will be offering some online classes for Telerik Sitefinity CMS training this coming June and July.

And a perk for DiscountASP.NET customers – our customers can get a 10% discount on Falafel training classes! Customers can log into their Control Panel and check out the Marketplace section for more information on the discount.

Takeshi Eto
VP Marketing and Business Development

Hosting Summit 2010: Microsoft Sees an Increasingly Hosted World

I’m here at the AZGroups Day of .NET event today and I’m totally behind in my posts so here’s one that I meant to publish last week.

I attended the Microsoft Hosting Summit 2010 the last week of April. This is an annual conference where Microsoft can present their strategy and vision to hosting providers from around the world, as well as a chance for Microsoft staff to meet with hosting providers. With over 350 people in attendance it was the biggest hosting summit yet.

Bob Muglia, President of the Server and Tools Business at Microsoft, spoke and made an interesting point which was further expanded upon in a presentation by David McCann, General Manager, Marketing & Strategy for Windows Server at Microsoft. And this point was that Microsoft sees an increasingly hosted world.

In numbers, Microsoft’s research shows an estimated number of servers in the world at around 30 million at this time.  They estimate that in 10 years time the number of servers in the world can grow to around 50 million. And the kicker was that Microsoft believes that by 2020, half of the world’s servers will be hosted – that’s 25 million servers in a hosted environment!

David McCann’s talk was in part a pep talk. If half the servers in the world will be hosted in 2020, then he said, the people in the room – the hosting providers of today – are the small elite group of forethinkers that will be helping forge the hosted world of tomorrow. This is part of the reason why Microsoft has been focusing on the hosting partners in the last several years. And, as a hosting partner, I would agree that Microsoft has been more and more engaged with hosting partners year to year.

In this increasingly hosted world that Microsoft projects, Microsoft itself is “all in” in building its Cloud computing infrastructure and competing with the likes of Google and Amazon. I totally understand this strategy and the need for Microsoft to move in this direction. However, the challenge will be in how Microsoft works with existing hosting partners as there will be some sectors of the hosting market where Microsoft will compete with their own partners.

The good thing as that the speakers did acknowledge this and that Microsoft is interested in being transparent and working with hosting partners to continue to evolve the hosting partner relationship. The next 10 years is certainly going to be an interesting ride and we will work hard to be relevant in this increasingly hosted world.

Takeshi Eto
VP Marketing and Business Development

Report Viewer Control 2010 available now

We have just installed Report Viewer Control 2010 on all our web servers.

There are plenty of new features that comes with Report Viewer Control 2010, including:

  • Support for 2008 RDL schema in local mode (i.e., rendering RDL on the web server rather than Reporting Service server).  With this, you can use new features like tablix, rich text, and gauge.
  • Support for ASP.NET AJAX
  • New “Look and feel”
  • Improved browser compatibility
  • Visual Studio 2010 integration

To learn more about Report Viewer controls, please visit http://msdn.microsoft.com/en-us/library/ms251671.aspx.

Frank Cheung
CTO

Microsoft Web Application Gallery Integrated into Control Panel

Last week we announced integrating the Microsoft Web Application Gallery into our hosting control panel providing our Windows 2008 hosting customers with one-click installation of many free packaged ASP.NET applications.

Here is a video demo on our web app gallery integration.

Michael Ossou

Research Article: Silverlight Surpasses Flash Use among Recent Shared ASP.NET Hosting Customer Web Sites

We published a Research Paper on the State of Silverlight previously, where we presented Silverlight and Flash adoption trends of web sites hosted at DiscountASP.NET for two or more years. In that study, we saw that Silverlight usage was gaining on Flash.

Recently, we conducted a similar survey for DiscountASP.NET customers who hosted their web sites for less than two years.

In this Research Article, we present some results on Silverlight and Flash adoption combining the data from the two recent surveys. By combining the data, we can present a more complete picture of the trends for Silverlight and Flash adoption.

This article is part of a larger research paper that is currently in progress.

Let us know what you think. Here is a link to the research article:

Silverlight Surpasses Flash Use among Recent Shared ASP.NET Hosting Customer Web Sites
Results from DiscountASP.NET Customer Survey

Takeshi Eto
VP Marketing and Business Development

Deploying a Web Application using Visual Studio 2010’s Deployment Feature

Visual Studio 2010 and .NET 4.0, bring us many new features.  The following video covers the new deployment tooling for Web Applications in Visual Studio 2010.

The deployment tool will package our application, upload it to the server, and then unpack it. It will also create the schema and populate the data on our production database auto-magically, based upon our development SQL Express database.  We will even touch on web.config transformations.

All this, in less than 10 minutes!

Michael Ossou

How web.config transformation simplifies web deployment

One of the most common questions that our technical support team hears is “Why does my web site work locally but not on your server?”  In most of these cases, the customer forgot to update some settings that are local to their development environment in the configuration file (for example; the database connection string).

When you deploy a web application to a production server, you often want to maintain different settings between the development and production environments.  For instance, you may want to set customError to “On” in production but leave it “Off” in development. With previous versions of Visual Studio .NET, you would have to manually edit the web.config file before you uploaded it to the server. But a cool new feature in Visual Studio .NET 2010 allows you to transform the web.config file when you deploy your application.

In this article I am going to demonstrate how to use web.config transformation to:

  • Change the database connection string
  • Change customError to “RemoteOnly”

Note: web.config transformation is only available in Web Application Projects.

  • Open your Web Application Project in Visual Studio 2010
  • In the Solution Explorer, click the “Show All Files” button
  • When you expand the web.config, you should see two additional files named Web.Debug.config and Web.Release.config. These files contain the transformation rules for the Debug and Release Configuration. You can add more configurations using the Configuration Manager (Build -> Configuration Manager).

In this example we are using a very simple web.config.

<?xml version="1.0"?>
<configuration>

   <appSettings/>
   <connectionStrings>
     <add name="ConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
   </connectionStrings>
   <system.web>
     <compilation debug="true" strict="false" explicit="true"/>
     <authentication mode="Windows" />
     <customErrors mode="Off" />
     <pages>
       <namespaces>
         <clear />
         <add namespace="System" />
         <add namespace="System.Collections" />
         <add namespace="System.Collections.Generic" />
         <add namespace="System.Collections.Specialized" />
         <add namespace="System.Configuration" />
         <add namespace="System.Text" />
         <add namespace="System.Text.RegularExpressions" />
         <add namespace="System.Web" />
         <add namespace="System.Web.Caching" />
         <add namespace="System.Web.SessionState" />
         <add namespace="System.Web.Security" />
         <add namespace="System.Web.Profile" />
         <add namespace="System.Web.UI" />
         <add namespace="System.Web.UI.WebControls" />
         <add namespace="System.Web.UI.WebControls.WebParts" />
         <add namespace="System.Web.UI.HtmlControls" />
       </namespaces>
     </pages>
 </system.web>

</configuration>

For the sake of simplicity, I am going to use only the Release Configuration.  Technically speaking, you can have a different transformation between Debug, Release or your own custom configuration.

Transform connection string

  • In the solution explorer, double click the Web.Release.Config
  • Add this node to the transformation file:
<connectionStrings>
  <add name="ConnectionString1"
    connectionString="Data Source=SQL2k801.discountasp.net; Initial Catalog=DatabaseName; Integrated Security=False;User Id=SQLUserName;Password=SQLPassword"
    xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
 </connectionStrings>

This line tells the transformation engine to replace the connectionString attribute in the original web.config with another connection string.

Transform Debug mode

In general, you do not want to run your application in debug mode in a production environment for performance reasons. By default, Visual Studio .NET 2010’s transformation file already has a rule to transform the debug setting to “Off:”

<compilation xdt:Transform="RemoveAttributes(debug)" />

Transform custom error

In most production applications, you would not want your user to see the complete error when the application throws an exception.
To transform the web.config’s custom error, you would add this node:

 <customErrors mode="RemoteOnly" xdt:Transform="Replace">
   <error statusCode="404" redirect="notfound.htm"/>
 </customErrors>

This line tells the transformation engine to Replace the customErrors node with this one. The resulting Transformation file will look like this:

<?xml version="1.0"?>

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

   <connectionStrings>
     <add name="ConnectionString1"
       connectionString="Data Source=SQL2k801.discountasp.net; Initial Catalog=DatabaseName; Integrated Security=False;User Id=SQLUserName;Password=SQLPassword"
 xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
 </connectionStrings>
 <system.web>
   <compilation xdt:Transform="RemoveAttributes(debug)" />

   <customErrors mode="RemoteOnly" xdt:Transform="Replace">
     <error statusCode="404" redirect="notfound.htm"/>
   </customErrors>
 </system.web>
</configuration>

When you deploy your application now, you will see that Visual Studio .NET will change the web.config file as we have specified above. This new feature should prevent a lot of site deployment headaches.

For more information on this topic, review the following:

Frank Cheung
CTO