Tech blog

Solving problems

About
Contact

Archive for the ‘microsoft’ tag

Installing and Activating the Remote Desktop Services License Server on Windows Server 2008 R2

leave a comment

So, you have purchased Microsoft Windows Server 2008 R2 and need to activate Remote Desktop Service Licence Server.

We have found following post here.

Unless licensing is configured during the initial installation of the Remote Desktop Services role on Windows Server 2008 R2, a 120 day grace period is provided before a license server needs to be installed and activated.

Installing the Remote Desktop Services License Server

The first step is to install the Remote Desktop Services License Services server role. The license server does not necessarily have to be installed on a system which is acting as a Remote Desktop Server. The installation can be performed using by selecting Roles from the tree in the left hand panel of the Server Manager tool.

If the server is already configured with the Remote Desktop Services role, scroll down the Roles summary page to the Remote Desktop Services section click on the Add Role Services link. In the resulting dialog titled Select Role Services select the check box next to Remote Desktop Licensing and then click Next to proceed to the Configure discovery scope for RD licensing screen as illustrated in the following figure:

In the first version of Windows Server 2008, it was necessary to specify a method by which RD Session Host servers (or Terminal Servers as they were known then) would auto-detect the server running the licensing server. With Windows Server 2008 R2, this approach is discouraged, and Microsoft now recommends that each RD Session Host be manually configured with information about the license server. In keeping with this recommendation, leave the Configure a discovery scope for this license server option unselected. Note, however, that this setting may be changed at a later time if required via the RD Licensing Manager tool. Click Next to proceed to the confirmation screen.

On a server which is does not have the Remote Desktop Services role installed, open the Server Manager, select Roles from the tree in the left hand panel and select Add Roles. Click Next on the initial screen if it appears so that the Select Server Roles screen is displayed. From the list of roles select the check box next to Remote Desktop Services and click on the Next button.

Read the information screen and then proceed to the Select Service Roles screen. Check the box next to Remote Desktop Licensing, click Next and follow the steps outlined above.

On the confirmation screen, verify that the information matches your expectations and click Install to initiate the installation process.

Activating the RD License Server

Once the RD License Server has been installed the next task is to activate it. This task is performed using the RD Licensing Manager which may be launched via Start -> All Programs -> Administrative Tools -> Remote Desktop Services -> Remote Desktop Licensing Manager. Once started, the Remote Desktop Licensing Manager dialog will appear containing a list of detected license servers on the network. The only license server listed in the following figure is the one on the local server. Because this has yet to be activated it is listed with a red circle containing an X mark next to it:

https://activate.microsoft.com web site using a browser and enter the product ID. Alternatively, if an internet connection is not available or a firewall prevents such access the activation may be performed over the telephone. If Automatic connection is selected, the following dialog will appear as the wizard attempts to contact Microsoft:

Once the Microsoft activation server has been located a new dialog will appear prompting for user, company and geographic location information. Complete these details and click Next to proceed. The second screen requests more detailed, but optional information. Either complete this information or click Next to skip to the activation process. Once again the wizard will contact Microsoft and complete the activation. Once completed, the following completion screen will appear:

Note that the Start Install Licenses Wizard now check box is selected by default. If you are ready to begin installing Client Access Licenses (CALs) now click on Next.

Installing Client Access Licenses (CAL)

A Client Access License (CAL) is required for each client requiring access to Windows Server 2008 R2 Remote Desktop Services. Once an RD License Server has been installed and activated the next step is to install the CALs. This can be performed as a continuation of the RD License Server activation process as outlined above, or at any other time by opening the RD Licensing Manager, right clicking on the appropriate license server in the list and choosing Install Licenses from the popup menu.

Once the Install Licenses wizard has started, click Next on the welcome screen to select the type of license program being used. Select the appropriate license type from the drop down list depending on how the licenses were acquired and then click Next to enter the license codes. On the License Program screen enter each code and press the Add button:

Select the license program corresponding to your license and click next to proceed to the License Code screen:

Enter each license key into this screen followed by the Add button. Once all the license codes have been added click on the Next button to complete the license installation process.

Configuring Licensing Settings on RD Session Hosts

Assuming that you followed Microsoft’s recommendation to manually configure the license server information for each RD Session Host it will now be necessary to perform this task. On each RD Session Host invoke the Remote Desktop Session Host Configuration tool by selecting the Start -> All Programs -> Remote Desktop Services -> Remote Desktop Session Host Configuration menu option. Within this tool, double click on the Remote Desktop licensing mode entry located in the Edit settings box listed under Licensing. In the resulting Licensing tab of the properties dialog select the appropriate licensing mode (per device or per user). Having defined the licensing mode, the next task is to specify the licensing server. Beneath the mode selection area, click on the Add… button to display the Add License Server dialog as illustrated in the following figure:

All known license servers will be listed in the left hand box. If the required servers are listed, select them and add them to the list of specified servers by clicking on the Add> button. If a server is not listed, manually type the name or IP address of the server in the text box provided and click the corresponding Add> button. Once all the required servers have been specified, click the OK button to commit the changes and dismiss the dialog.

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

System.Web.HttpException: Request is not available in this context

leave a comment

Use HttpContext.Current.Request instead of Request

i.e.

HttpContext.Current.Request.UserHostAddress

not

Request.UserHostAddress

VN:F [1.9.3_1094]
Rating: 2.5/5 (2 votes cast)
VN:F [1.9.3_1094]
Rating: +2 (from 2 votes)

Comparison: ASP .NET WebForms vs MVC

leave a comment

Comparison: ASP .NET WebForms vs MVC

WebForms MVC
  • Requires .NET 2.0
  • Event model – button click triggers an event in code-behind
  • ViewState – server-based forms for easier management
  • Existing third party controls
  • Requires .NET 3.5 and MVC library
  • Requires IIS 6.0 or later for URL rewritting – btw, max IIS version for WinXP is 5.1
  • Backward compatible – developer can include WebForms pages into MVC website and vice-versa
  • Dividing an application into the model, the view, and the controller – data, design and code are separated
  • For large teams of developers and designers (parallel work)
  • No ViewState means smaller output and cleaner html
  • Portable among other languages (like php) – similar file hierarchy, object names, different syntax
  • 30-50% faster than Web Forms, 100-800 requests per second
  • Native URL rewritting
  • Skinnable, suitable for websites that are viewed in computer browsers and mobile browsers
  • Unit testing
  • VN:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: +3 (from 3 votes)

    Written by Avivo

    January 30th, 2010 at 11:41 pm

    Most helpful windows keyboard shortcuts

    one comment

    We have found this list at this location and decide to share with all of you.

    Let’s learn how to use the 15 top most commonly used Windows XP shortcuts.

    15 Helpful Keyboard Shortcuts

    To take advantage of this drill, you should be comfortable using a keyboard, otherwise the speed you want to increase will be taken away by you not being entirely sure where a certain key is, so it helps to be familiar with the layout.

    First, take a good look at your keyboard and be familiar with the layout. Most of you will have something similar to the illustration seen here as this is a standard 101 key keyboard layout.


    Figure 1

    Note:
    Laptop users may have the same keys on their systems, but in different places so take a second to familiarize yourself with key placement before you begin the exercise. If you have something similar, then you will be fine. Many peripheral vendors added a lot to their keyboards, such as multimedia options and so on.

    Tip 1: Quickly Accessing the Start Menu

    Keyboard Shortcut: Windows key


    Figure 2

    If you are just plan old ‘sick and tired’ of using the mouse to click on the infamous button to display the Windows Start Menu, then you simply only need to hit the ‘Windows’ Key. Using either or (there are usually two of them, one on a laptop keyboard) so you can use either or. The Windows key once pressed will launch the start menu – once you release the key, the menu will appear. Get used to this key; many of the other shortcuts you will use rely on this key.

    Note:
    You may have a ‘very’ old keyboard that may not include the Windows Key on it. You will not be able to use this shortcut unless you get a new keyboard.

    You can also use Ctrl + Esc

    Tip 2: Quickly getting to your System Properties

    Keyboard Shortcut: Windows key + Pause/Break


    Figure 3

    There will certainly be times where you will need to access the System Properties for your computer. When you need to get to the properties, many times you will go through a pretty long exercise. There are a couple of ways to get to the properties, most commonly by right clicking the mouse over the ‘My Computer’ icon on your desktop and then selecting properties from the drop down menu. If you do this very often, you may consider using this keyboard shortcut.

    Tip 3: Quickly getting to your Run Dialog Box

    Keyboard Shortcut: Windows key + R


    Figure 4

    The Run dialog box is used to allow you to either browse to a command to run, or simply enter the path to one if not already entered in the system’s path statement. (path=)

    To quickly run an executable (such as calc.exe), just type calc in the Run dialog box and if in the path statement, it will simply run. The Run dialog box is used often so this shortcut will really come in handy.

    Note:
    You can also quickly access websites by entering URLs in the Run dialog box …. http://www.rsnetworks.net/

    -or- You can also open files with the following: file:///C:/filename.txt

    Tip 4: Quickly Locking your System

    Keyboard Shortcut: Windows key + L


    Figure 5

    There will surely be times where you want to quickly step away from your system and not leave it accessible to prying eyes in the office or home. How do you quickly lock up your PC and allow it to be secure from immediate access at the console? By locking it up, that’s how.
    Commonly, the quickest way to do this was to use the Ctrl+Alt+Del key sequence (will be covered shortly) which would allow you to select an option to ‘Lock Workstation’. Using this keystroke will allow you from moving to using three keys and the mouse to navigate to a simple keystroke that will lock your system immediately.

    Tip 5: Quickly Search for Anything

    Keyboard Shortcut: Windows key + F
    Keyboard Shortcut: Windows key + Ctrl + F


    Figure 6

    If you want to find files (and or computers, and other random things on your system) you will want to use the Search feature built into Windows XP. To use this, remember the old name for it, which was simply Find. Now – the Windows Key + F will invoke the Search function and within a few seconds, you should see your Search Results dialog box come up. Use this feature to find items on your system or on remote systems that you may have access and connections to. You can also use this feature to find other computers on your network if you wanted to add the ctrl key in that keystroke sequence. If not, you can use the original keyboard shortcut and then just select Computers or people as the criteria you want to search.

    Tip 6: Quickly Minimizing and Restoring Windows

    Keyboard Shortcut: Windows key + D


    Figure 7

    One of my favorite keyboard shortcuts is the Windows Key + D shortcut. Try to remember the word ‘desktop’ when you try to remember the D, think of using this shortcut to reveal the ‘desktop’ and it may help you remember it.

    Many times I am very tied up (like right now) with many Windows open on my system. This is because most times, I am working within multiple applications. There are times where I may want to view the desktop for one reason or another, and that can ‘very’ quickly be done with a keystroke. There were many ways to minimize all Windows that may be blocking view of the desktop, but this is one of the quickest. Another very quick way is if you have the ‘quick launch’ toolbar setup in your Taskbar. If you do in fact have this set up, this is also a quick way to reveal the desktop, as well as to put it back again.

    Tip 7: Quickly getting to the Utility Manager

    Keyboard Shortcut: Windows key + U


    Figure 8

    Users can start accessibility programs before logging on to the computer by using this keystroke. If you are fond of using the Utility Manager, then this keyboard shortcut will definitely help you to get to it. Tools such as ‘Magnifier’ and ‘Narrator’ can be set to start automatically and so on with this system utility.

    Note:
    Utility Manager enables users to check an accessibility program’s status and start or stop an accessibility program. Users with administrator-level access can designate to have the program start when Utility Manager starts. The built-in accessibility programs available from the Utility Manager are Magnifier, Narrator, and On-Screen Keyboard. Narrator, a text-to-speech program, starts when Utility Manager opens. This gives users who are blind or have impaired vision immediate access to Utility Manager. Using Utility Manager, you can tell Windows to automatically start accessibility programs each time you log on to your computer, when you lock your computer desktop, or when Utility Manager starts.

    Tip 8: Quickly getting to Help and Support

    Keyboard Shortcut: Windows key + F1


    Figure 9

    If you are in need of help or support, look no further. By using Windows Key + F1 (the F1 key), then you can use the help and support system that comes with Windows XP.

    Note:
    Help and Support may take a second to load on most systems, so be patient.

    Tip 9: Quickly getting to Windows Explorer

    Keyboard Shortcut: Windows key + E


    Figure 10

    Here is another great shortcut you may not know about. If you want to access Windows Explorer (not Internet Explorer – the Web browser), you can use the Windows Key + E shortcut. This will open up Windows Explorer for you so you can manage files and other forms of data on your system.

    Be aware that this may take a moment to open if you are working on a network and have mapped drives, so be patient if it takes a moment.

    Tip 10: Quickly delete something without being ASKED to

    Keyboard Shortcut: Shift + Del


    Figure 11

    This is absolutely my all time favorite shortcut, now you can delete something from your system and not be asked 82 times if I really am sure I want to do that…. this keyboard shortcut allows you to bypass the asking – your data is deleted without question.

    Note:
    This is only dangerous if you are not sure if you want to delete something or not, but honestly, with the fact being that you have to ‘empty’ your recycle bin anyway… as long as you don’t have a task set up to do it – then this is definitely something you want to consider.

    Tip 11: Quickly getting to your shortcut menu

    Keyboard Shortcut: Windows key


    Figure 12

    Newer keyboards have a key that allows you to now get properties menus from anything you select that can provide you with a menu. For instance, if you have Office document on your desktop (let’s say, a spreadsheet named tax.xls) then you can select it and press the Window key and then the shortcut menu key and you can now quickly view properties for a selected object. Although this is not the ‘fastest’ keystroke sequence in the world, it happens to be a very helpful one especially if you do not have a mouse attached to your system.

    Tip 12: Quickly getting to your Task Manager

    Keyboard Shortcut: Ctrl + Alt + Del


    Figure 13

    By far the most commonly used keystroke sequence used on just about any and every Windows system ever created. By pressing (and holding down) the Control key (ctrl), then the Alt key (Alt), and then the Delete key (Del), it will allow you to lock your workstation, change a password as well as use Task Manager.

    Tip 13: Quickly switch between running programs

    Keyboard Shortcut: Alt + Tab


    Figure 14

    If you work with many programs (most people who work on computers these days fit this description) then you will definitely want to learn about and master the Alt + Tab keystroke sequence. By selecting the Alt key and then holding it down (try this with your left thumb) and then use the tab key to switch between running programs, highlighting and selecting a specific program will bring that one to the foreground, maximized in your screen so that you can work within it. Releasing the Alt key brings up the program you want to use.

    Note:
    This keystroke needs to come with a small warning. If you hit the Caps Lock key by accident, then you will get no results other than your Caps Lock being on and maybe causing you some confusion and headaches a little later on. As well, if you hit the Alt key only by accident, it will select the ‘menu’ in just about any open dialog box you have in the foreground. Just be aware that missing keys and hitting others in this situation will not only cause you to not get the result you wanted, but then some unwanted results as well.

    Tip 14: Quickly Getting to Full Screen Command Prompt

    Keyboard Shortcut: Alt + Enter


    Figure 15

    If you want to see the Command Prompt in full screen (not in a small Window), you can quickly expand it to full screen with the Alt + Enter keystroke sequence. The only problem with this is, you need to have the Command Prompt open to expand it to full screen, so, to open it you can use the Run dialog box.

    Here is a way to use two keyboard shortcuts at once… as you may recall, we already learned the shortcut to get to the Run dialog box, which was using the Windows Key + R. Now, once open, type cmd and hit enter. This will then open your Command Prompt.

    CMD gives you full screen mode only if you select it from the properties of the Command prompt Windows – you can select full screen mode by default, but I don’t like it this way, it is too intrusive and cumbersome – using the Keyboard shortcut will give you want you want very quickly and give you access to both types (Windows or Full Screen) as quickly as you can hit the keystroke sequence.

    Note:
    Alt + Enter can be very confusing because its one keystroke that does ‘many’ different things depending on where you are at the time of usage. Alt + Enter with no programs open it may do nothing. Just be aware of how you are using the command keystroke and what you have open at the time.

    VN:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)

    Written by Avivo

    December 22nd, 2009 at 11:44 pm

    Saving Changes is Not Permitted?

    leave a comment

    We tried to add new ntext nullable column in MS SQL table.  We were quite surprised to get the following error message:

    image

    Saving changes is not permitted.  The changes you have made require the following tables to be dropped and re-created.  You have either made changes to a table that can’t be re-created or enabled the option Prevent saving changes that require the table to be re-created.

    It wouldn’t let us add an “Allow Nulls” column?  That just seemed absurd.

    Apparently, this is now the default behavior for any of the following changes to a table:

    • Adding a new column to the middle of the table
    • Dropping a column
    • Changing column nullability
    • Changing the order of the columns
    • Changing the data type of a column

    In order to prevent this default behavior, you simply need to uncheck a box in the table designer options using the Tools -> Options menu item

    image

    Expand the Designers section to display the Table and Database Designers options.

    image

    To change this behavior, just uncheck the “Prevent saving changes that require table re-creation” checkbox.

    Original article was published at http://codeslammer.wordpress.com/2008/10/19/saving-changes-is-not-permitted/

    VN:F [1.9.3_1094]
    Rating: 5.0/5 (1 vote cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)

    Written by developer

    December 21st, 2009 at 4:44 pm

    Could Not Load Type in ASP.NET MVC

    leave a comment

    If you got this message you have missing web.config in Views directory.

    You have this file in your development project – click on it in Visual Studio and set to Copy Local, so it will be copied when you click Publish.

    VN:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)

    Written by Avivo

    November 30th, 2009 at 5:39 pm

    Visual Studio 2008 and Windows Service project and setup

    leave a comment

    Problem is that Visual Studio 2008 does not have Windows Service project and you can not add it and create a setup for this project.

    To override this use manual approach:

    1. Create your service class manually:

    using System;
    using System.Diagnostics;
    using System.ServiceProcess;
    
    namespace WindowsService
    {
        class WindowsService : ServiceBase
        {
            ///
            /// Public Constructor for WindowsService.
            /// - Put all of your Initialization code here.
            ///
            public WindowsService()
            {
                this.ServiceName = "My Windows Service";
                this.EventLog.Log = "Application";
    
                // These Flags set whether or not to handle that specific
    
                //  type of event. Set to true if you need it, false otherwise.
    
                this.CanHandlePowerEvent = true;
                this.CanHandleSessionChangeEvent = true;
                this.CanPauseAndContinue = true;
                this.CanShutdown = true;
                this.CanStop = true;
            }
    
            ///
            /// The Main Thread: This is where your Service is Run.
            ///
            static void Main()
            {
                ServiceBase.Run(new WindowsService());
            }
    
            ///
            /// Dispose of objects that need it here.
            ///
            ///
    Whether
            ///    or not disposing is going on.
            protected override void Dispose(bool disposing)
            {
                base.Dispose(disposing);
            }
    
            ///
            /// OnStart(): Put startup code here
            ///  - Start threads, get inital data, etc.
            ///
            ///
    
            protected override void OnStart(string[] args)
            {
                base.OnStart(args);
            }
    
            ///
            /// OnStop(): Put your stop code here
            /// - Stop threads, set final data, etc.
            ///
            protected override void OnStop()
            {
                base.OnStop();
            }
    
            ///
            /// OnPause: Put your pause code here
            /// - Pause working threads, etc.
            ///
            protected override void OnPause()
            {
                base.OnPause();
            }
    
            ///
            /// OnContinue(): Put your continue code here
            /// - Un-pause working threads, etc.
            ///
            protected override void OnContinue()
            {
                base.OnContinue();
            }
    
            ///
            /// OnShutdown(): Called when the System is shutting down
            /// - Put code here when you need special handling
            ///   of code that deals with a system shutdown, such
            ///   as saving special data before shutdown.
            ///
            protected override void OnShutdown()
            {
                base.OnShutdown();
            }
    
            ///
            /// OnCustomCommand(): If you need to send a command to your
            ///   service without the need for Remoting or Sockets, use
            ///   this method to do custom methods.
            ///
            ///
    Arbitrary Integer between 128 & 256
            protected override void OnCustomCommand(int command)
            {
                //  A custom command can be sent to a service by using this method:
                //#  int command = 128; //Some Arbitrary number between 128 & 256
                //#  ServiceController sc = new ServiceController("NameOfService");
                //#  sc.ExecuteCommand(command);
    
                base.OnCustomCommand(command);
            }
    
            ///
            /// OnPowerEvent(): Useful for detecting power status changes,
            ///   such as going into Suspend mode or Low Battery for laptops.
            ///
            ///
    The Power Broadcast Status
            /// (BatteryLow, Suspend, etc.)
            protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus)
            {
                return base.OnPowerEvent(powerStatus);
            }
    
            ///
            /// OnSessionChange(): To handle a change event
            ///   from a Terminal Server session.
            ///   Useful if you need to determine
            ///   when a user logs in remotely or logs off,
            ///   or when someone logs into the console.
            ///
            ///
    The Session Change
            /// Event that occured.
            protected override void OnSessionChange(
                      SessionChangeDescription changeDescription)
            {
                base.OnSessionChange(changeDescription);
            }
        }
    }

    2. Add installer class:

    using System;
    using System.ComponentModel;
    using System.Configuration.Install;
    using System.ServiceProcess;
    
    namespace WindowsService
    {
        [RunInstaller(true)]
        public class WindowsServiceInstaller : Installer
        {
            ///
            /// Public Constructor for WindowsServiceInstaller.
            /// - Put all of your Initialization code here.
            ///
            public WindowsServiceInstaller()
            {
                ServiceProcessInstaller serviceProcessInstaller =
                                   new ServiceProcessInstaller();
                ServiceInstaller serviceInstaller = new ServiceInstaller();
    
                //# Service Account Information
                serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
                serviceProcessInstaller.Username = null;
                serviceProcessInstaller.Password = null;
    
                //# Service Information
                serviceInstaller.DisplayName = "My New C# Windows Service";
                serviceInstaller.StartType = ServiceStartMode.Automatic;
    
                //# This must be identical to the WindowsService.ServiceBase name
                //# set in the constructor of WindowsService.cs
                serviceInstaller.ServiceName = "My Windows Service";
    
                this.Installers.Add(serviceProcessInstaller);
                this.Installers.Add(serviceInstaller);
            }
        }
    }

    3. Use Framework 2.0 instalutil.exe to create Installation:

    Install.bat

    @ECHO OFF
    
    REM The following directory is for .NET 2.0
    set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727
    set PATH=%PATH%;%DOTNETFX2%
    
    echo Installing WindowsService...
    echo ---------------------------------------------------
    InstallUtil /i WindowsService.exe
    echo ---------------------------------------------------
    echo Done.

    Uninstall.bat

    @ECHO OFF
    
    REM The following directory is for .NET 2.0
    set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727
    set PATH=%PATH%;%DOTNETFX2%
    
    echo Installing WindowsService...
    echo ---------------------------------------------------
    InstallUtil /u WindowsService.exe
    echo ---------------------------------------------------
    echo Done.
    VN:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)

    Written by Avivo

    October 21st, 2009 at 2:19 pm

    ArrayOfXElement not recognized by Silverlight 2.0

    one comment

    Last weekend I was working on a Silverlight 2.0 game that loads and saves scores to an external database. Database is accessed via web service which has two methods: GetScore and SaveScore. GetScore returns DataSet and SaveScore returns nothing.

    Web service proxy is generated as usual – right click on the project node in VS2008, “Add Service Reference…”, enter url, proxy class is generated and the methods are accessible in the code. But when I tried to build the project an error occured: “The type or namespace name ‘ArrayOfXElement’ does not exist in the namespace” which means that ArrayOfXElement is unrecognized class for the compiler. Searching on the Google reveals that this happens when service method returns DataSet, so ArrayOfXElement is actually DataSet and DataSets are not supported in Silverlight 2.0.

    A quick solution is to replace all ‘ArrayOfXElement’ words with ‘object’. Project would build that way but the data would have no meaning.

    Another solution is to change the web service return type but this is not always editable by the client side developer.

    Finally, workaround idea is to get DataSet schema and convert it to a class. How to do this?
    1. Create a dummy WPF project.
    2. Add web service reference to the WPF project. Return type is DataSet instead of ArrayOfXElement.
    3. Write some code to call a web service methods that returns DataSet then extract xsd schema and save it to the disk. Build and run. Sample:
    GameServiceClient client = new GameServiceClient();
    DataSet ds = client.GetScore(1, “abc”, “”, DateTime.Now);
    ds.WriteXmlSchema(@”C:\Temp\Score.xsd”);
    4. So you have the xsd file. Now find ‘xsd.exe’ which is located in the same directory as ‘svcutil.exe’ (e.g. C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin). Run it with arguments:
    xsd C:\Temp\Score.xsd /c
    5. xsd tool generates Score.cs file which contains tables as classes and columns as properties. Include the generated file in the Silverlight project.
    6. Replace all ‘ArrayOfXElement’ words with ‘NewDataSet’ or other class name, depends on the retrieved DataSet name and generated code.

    Note that this is just an idea. So far the sample project builds fine but there is a problem with cross-domain security. Another story.

    Url to the web service in this example:
    http://www.silverlightclub.com/apps/GameService.asmx

    References:
    http://silverlight.net/forums/t/60518.aspx
    http://blogs.msdn.com/suwatch/archive/2009/01/21/wcf-silverlight-exception-and-serialization.aspx

    VN:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: +1 (from 1 vote)

    Written by Avivo

    March 21st, 2009 at 8:26 pm

    Silverlight 2 Plugin not working

    2 comments

    Well, maybe you will expirience a problem that Silverlight 2 plugin is not working eventhough you have the latest version 2.0.30825.0

    It is showing MIME type: application/x-silverlight-2-b2

    This can be if you have old Silverlight 2 Beta version 2.0.10125.0 in bin directory of your website/application.

    Just ovewrite it with latest version and it will be ok.

    Magic!

    VN:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.3_1094]
    Rating: 0 (from 0 votes)

    Written by Avivo

    February 17th, 2009 at 9:43 pm