Thursday, April 29, 2010

Debugging Silverlight applications

How to debug silverlight applications? Few of us will be having this problem and the issues is “Debugger not getting hit in the Silverlight project “. Here is the answer its pretty simple solution for this.

All Silverlight applications will have a hosting application which will be an ASP.NET web application or web site...

1. Right click the ASP.NET web application – -> Properties

2. In the properties window, select the tab Start Options.

3. In the debugger’s section, check the Silverlight checkbox.

image

4. Clik OK on the project properties window.

5. Hit F5. Now you will be able to debug the Silverlight project.

Hope this helps.

Wednesday, April 28, 2010

Key Press Event For Silverlight Textbox

This how we need to do to capture Key Press Event for Sliverlight text box. Attach KeyDown Event in XMAL code in MainPage.xaml file.

 

<TextBox x:Name="customer_name"

KeyDown="customer_name_KeyDown" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="10.667" Width="120" Height="22"/>


In the codebehind you can check with the Key value like example shown below in MainPage.xaml.cs file.

private void customer_name_KeyDown(object sender, KeyEventArgs e)
        {
         
            if (e.Key == Key.Enter)
            {
                e.Handled = true;
            }
            else
            {
                e.Handled = false;
            }
        }
 

Unable to start debugging. The Silverlight managed debugging package isn’t installed.

If you installed latest version of Silverlight (Silverlight 4), it may break the your current silverlight development environment. After in the Silverlight 4 installation, if you try to debug any Silverlight 3 project, you will get a message from Visual Studio 2008, saying “Unable to start debugging. The Silverlight managed debugging package isn’t installed.”

image

To fix this error, install the Silverlight Developer Run time. You can get it from here : http://go.microsoft.com/fwlink/?LinkID=188039.

It worked for me. Hope this helps for you.

Monday, April 26, 2010

Deploying WCF Service in IIS : no svc MIME Type

I have started My First SilverLight application with WCF Service. When i want to deploy on IIS, i got this error saying no MIME type for this extension SVC not found. It is happening because this MIME type is not registered IIS.

Exception Details:

Server Error in Application “Default Web Site/MyFirstSLApp”
HTTP Error 404.3 – Not Found
Description: The page you are requesting cannot be served because of the Multipurpose Internet Mail Extensions (MIME) map policy that is configured on the Web server. The page you requested has a file name extension that is not recognized, and is not allowed.
Error Code: 0×80070032

I tried IIS MIME Types and I couldn’t found an application mapping for SVC file. After doing some goggling I found the fix.  You can resolve this using WCF Installation utility which comes with .Net Framework 3.0. Run the command prompt as Administrator, go to the Windows Communication Foundation folder in c:\Windows\Microsoft.NET\Framework\v3.0\ folder. Execute the servicemodelreg.exe with -i or /i switch.

wcf 

After the installation this try reloading the Page. It will fix this issue.