Sunday, October 11, 2009

Silverlight 3 Could Not download the silverlight Application

I created a simple Silverlight 3 app.

<UserControl x:Class="SilverlightApplication2.MainPage"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
    <Grid x:Name="LayoutRoot">
        <TextBlock Text="Hello World!" ></TextBlock>

When I run it I get an error about not being able to download the silverlight app

Line: 56
Error: Unhandled Error in Silverlight Application
Code: 2104   
Category: InitializeError      
Message: Could not download the Silverlight application. Check web server settings   

Well if you look in the ClientBin folder you will see it is empty so the xap file is not available to be used

To fix this right click on the web application and select Build Order.  On the Dependencies tab make sure the Checkbox next to the Silverlight app is checked.

Saturday, May 23, 2009

Windows 7 RC User Profile Service Failed the Logon

I upgraded my laptop the other day to use Windows 7 RC.  I am really liking the speed improvements and the windows virtual pc that it comes with. Dont forget to enable virtualization on your microprocessor in your computer's bios settings if you want to use windows virtual pc.

 The other day after the upgrade I was not able to log into my account. I got an message User Profile Service Failed the Logon.   The error was caused by a messed up registry key for the user profile for my account.  Well I was able to boot into safe mode and follow the instructions in this post in the Windows Vista Forums and fix the problem.  

Thursday, March 26, 2009

Getting Windows Mobile Device ID

I got email today asking me how to get the device ID from a pocket pc with vb

Imports System.Text
Public Class Form1
    <System.Runtime.InteropServices.DllImport("coredll.dll")> _
Private Shared Function GetDeviceUniqueID(ByVal appdata As Byte(), ByVal cbApplictionData As Integer, ByVal dwDeviceIDVersion As Integer, ByVal deviceIDOuput As Byte(), ByRef pcbDeviceIDOutput As Integer) As Integer
    End Function
    Private Function GetDeviceId(ByVal appData As String) As Byte()
        Dim appDataBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(appData)
        Dim outputSize As Integer = 20
        Dim output(19) As Byte
        Dim result As Integer = GetDeviceUniqueID(appDataBytes, appDataBytes.Length, 1, output, outputSize)
        Return output
    End Function
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim sbId As New StringBuilder
        Dim bID() As Byte = GetDeviceId("MyAppName")
        For Each b In bID
            sbId.Append(String.Format("{0:x2}", b))
    End Sub
End Class