I’ve just found a nice and *very* detailed article how to work with Windows 7 taskbar buttons similar to Windows Media Player and Zune app.
Check out Pete Brown’s blog post “Working with Windows 7 Taskbar Thumbnail Buttons with WPF 4 ”
| Today Microsoft put live latest release of the Facebook .NET SDK that supports the newest Facebook services delivered through the Facebook Open Stream API and can be used in any of your favorite Microsoft development platforms; Silverlight, WPF, ASP.NET, ASP.NET MVC, and Windows Forms. |
Get started today at www.microsoft.com/facebooksdk.
There are many walkthroughs that can help you reveal new features in your favorite programming IDE
Enjoy!
Just found very useful command from TFS Power Toys: tfpt unshelve. It’s capable of migrating a shelveset from a branch to another, it does that by performing a baseless merge, so you will need to resolve the conflicts produced. The syntax of the command looks like the following:
1: tfpt unshelve shelvsetName /migrate /source:$/SourceBranch /target:$/TargetBranch
There are several articles showing how to host non-http protocols on IIS7. Some steps are like black box while others could easily be misconfigured.
The tasks is complicated additionally by obscured error messages returned in the browser :)
So let’s started (the example below is in Windows Server 2008. In Vista/Windows7 is similar but not exactly same):
Phase 1: Prepare server (prerequisites)
1. Add Web Server Role
- Select following features as a minimum:
- Common HTTP Features - all
- Application Development
- ASP.NET
- .NET Extensibility
- ISAPI extensions
- ISAPI Filters
- Security – all
2. Add Application Role
Add Application Server role and select all features (confirm all dependencies):
With this Phase 1 is complete. We should be able to navigate to Internet Information Services (IIS) Manage console in Administrative tools.
Phase 2: Deploying WCF application
1. Build WCF application with netTcpBinding :) (kindda obvious). For service endpoints leave address relative or empty.
1: <services>
2: <service name="Microsoft.Test.Service" behaviorConfiguration="Service.ServiceBehavior">
3: <!-- Service Endpoints -->
4: <endpoint name="netTcp" address="" binding="netTcpBinding" bindingConfiguration="bigMessages" contract="Microsoft.Test.IService" />
5: <endpoint name="mexNetTcp" address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
6: </service>
7: </services>
2. Create website that will host it in IIS
Since it is not a challenge to create it via IIS Manager here is how it can be achieved via script (JS). This can be used as custom action in WiX/MSI as well
1: var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
2: adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
3:
4: var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
5:
6: var sitesCollection = sitesSection.Collection;
7:
8: var siteElement = sitesCollection.CreateNewElement("site");
9: siteElement.Properties.Item("name").Value = "WcfNetTcp";
10: siteElement.Properties.Item("id").Value = 7;
11:
12: var bindingsCollection = siteElement.ChildElements.Item("bindings").Collection;
13:
14: var bindingElement = bindingsCollection.CreateNewElement("binding");
15: bindingElement.Properties.Item("protocol").Value = "http";
16: bindingElement.Properties.Item("bindingInformation").Value = "*:80:";
17: bindingsCollection.AddElement(bindingElement);
18:
19: var siteCollection = siteElement.Collection;
20:
21: var applicationElement = siteCollection.CreateNewElement("application");
22: applicationElement.Properties.Item("path").Value = "D:\\Hosting\\WcfApp";
23: applicationElement.Properties.Item("applicationPool").Value = "DefaultAppPool";
24: siteCollection.AddElement(applicationElement);
25:
26: sitesCollection.AddElement(siteElement);
27:
28: adminManager.CommitChanges();
29:
3. Add net.tcp protocol:
Here is how it should look from GUI:
And the script for it
1: var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
2: adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
3:
4: var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
5:
6: var sitesCollection = sitesSection.Collection;
7:
8: var siteElementPos = FindElement(sitesCollection, "site", ["name", "WcfNetTcp"]);
9: if (siteElementPos == -1) throw "Element not found!";
10: var siteElement = sitesCollection.Item(siteElementPos);
11:
12:
13: var bindingsCollection = siteElement.ChildElements.Item("bindings").Collection;
14:
15: var bindingElement = bindingsCollection.CreateNewElement("binding");
16: bindingElement.Properties.Item("protocol").Value = "net.tcp";
17: bindingElement.Properties.Item("bindingInformation").Value = "809:*";
18: bindingsCollection.AddElement(bindingElement);
19:
20: adminManager.CommitChanges();
4. Enable net.tcp for website (Virtual Application) that hosts Wcf Service – in this example we’re hosting in the root of website
And of course the script:
1: var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
2: adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
3:
4: var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
5:
6: var sitesCollection = sitesSection.Collection;
7:
8: var siteElementPos = FindElement(sitesCollection, "site", ["name", "WcfNetTcp"]);
9: if (siteElementPos == -1) throw "Element not found!";
10: var siteElement = sitesCollection.Item(siteElementPos);
11:
12: var siteCollection = siteElement.Collection;
13:
14: var applicationElementPos = FindElement(siteCollection, "application", ["path", "/"]);
15: if (applicationElementPos == -1) throw "Element not found!";
16: var applicationElement = siteCollection.Item(applicationElementPos);
17:
18: applicationElement.Properties.Item("enabledProtocols").Value = "http,net.tcp";
19:
20: adminManager.CommitChanges();
Warning: Do not put any spaces in “Enabled Protocols” field. Although it might works for HTTP it doesn’t for net.tcp.
5. (Optional) Run in elevated mode (As Administrator):
1: “%WINDIR%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" –i
I will cover why it is optional in next posts.
Note: Scripts are generated using IIS 7.5 IIS Management console and Windows 7
Hope that helps.
P.S. Here is the helper js function FindElement(). It is slightly modified from original generated by IIS Manager so it will compare values in case insensitive way.
Tim Heuer posted a great series of articles targeted a new Silverlight developers. These can be used to ramp up with new things in v3 as well as Silverlight concepts.
Original post here.
and learn WF4/WCF4 :)
VS 2010 Beta 1 has been put for download for MSDN subscribers and it is matter of hours to become available for public download (I will update the post once I have the link).
UPDATE: VS 2010 and .NET 4 Beta 1 is available for download.
Of course there are new things but looks like the focus is not on learning new ways to do old things but really make things easier. Takes a look at this nice story in pictures Developer Division GM Jason Zander posted.
The MSDN Code Gallery site has updated WF 4/ WCF 4 Training kit for all interested in bleeding edge features:
Introduction to Workflow 4
In this lab you will get to know the basics of creating, hosting and running a workflow. This lab is also intended to be an introduction to the new workflow authoring constructs in the .NET Framework 4 and Visual Studio 2010, including the new Workflow Designer, expressions, variables and arguments. Additionally, you will explore the use of some basic built-in activities.
Introduction to Workflow Services using .NET Framework 4
This hands-on lab is intended to introduce developers to writing workflow services using .NET Framework 4. You will examine the different messaging activities of Windows Workflow, and learn how to configure them to create a distributed application. This lab is built around a specific HR business scenario where candidates submit their applications and are hired or rejected based on an evaluation process.
Workflow Designer Programming Model
This hands-on lab introduces you to the designer programming model of Windows Workflow 4. You will learn how to rehost the workflow designer in a WPF desktop application and how to create composite custom designers for your workflow activities.
Creating Flowchart Workflows
This lab is intended to be an introduction to the Flowchart paradigm used in Workflow development. In this lab you will learn how to create Flowchart Workflows using the designer, and you will also learn the usage of several of the provided activities and how to create custom activities easily.
Monitoring Workflow Services using .NET Framework 4
During the life cycle of an application, developers and system administrators often need to monitor running services in order to perform health checks or troubleshoot issues. The Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) runtimes already come with a built-in tracking infrastructure, making it easy to enable monitoring within your WCF and WF applications. In this hands-on lab you will learn how you can leverage some of the main WF and WCF monitoring features to track application execution and troubleshoot problems with services when necessary.
WCF Service Discovery using .NET Framework 4
Windows Communication Foundation 4 includes a new feature that enables service discovery. Service discovery allows you to locate services on the same subnet using ad hoc discovery, or using a proxy to establish connections with servers regardless of where they are. In this lab you will create a simple chat application that will use both methods to learn about available services.
Then I remembered how good error messages are built: they should contain three parts. No less because it cannot provide full information. No more because user is overwhelmed. Exactly three:
- Describe what happened – first part briefly describes what went wrong.
- Give directions what to fix – user might really know what to fix. It could be just overlooked. Tell them what to change to fix the problem. Even program/PC restart is a solution.
- What next?! What if the problem still persist?! – If we are here then the problem is serious. And the user have tried basic scenarios to fix and can call someone for help without feeling stupid/guilty that don’t know how to fix the problem.
On other hand this is extremely useful message:
P.S. Plan A did the job :)
This is not very wide known feature in Visual Studio that has been there even in version 2005 but still there are not many articles on it.
When you try to get code coverage from functional tests then the default UI features in VS won’t help. This is because code coverage is measured only on referenced assemblies (from what I was able to understand). The steps below actually describe the process of collecting code coverage data.
In order collect code coverage information on service – could be remotely hosted WCF service, or local WCF service but hit through endpoint – following steps should be executed:
1. Instrument the assemblies – did you think that code coverage is that simple :). VsInstr.exe is the tool for that.
1: VsInstr.exe /coverage wcfService.dll
2. Deploy assemblies – This step means actually installing deployed instrumented assemblies on the IIS. On other side default WcfSvcHost.exe also can be used:
WcfSvcHost.exe" /service:%cd%\WcfService.dll /config:%cd%\WcfService.dll.config
3. Start VS monitor that collects data -this is separate tool - VSPerfCmd.exe. Sample usage is
VSPerfCmd.exe /start:coverage /output:”C:\CoverageData.coverage” /cs
4. Run your tests that hit the service.
5. Stop the monitor.
6. Open c:\CodeCoverageData.coverage in VS
Hope this helps…
Ops. Almost forgot. I wasn’t able to make it work on x64 bit machine. For this purpose I had to use x86 version of .. Windows, of course :) !
Here are some useful links:
There are too many acronyms in today’s worlds so let me help you understand these two: - WCF –Windows Communication Foundation
- UFC - Ultimate Fighting Championship
You might started to think how these two are related?! Well they are not :). But I find some analogy between the martial arts events and the new initiative to popularize .NET platform for enterprise programming – WCF called WCF Champ Web Campaign. | (photo courtesy Flickr). This is the pretty face of UFC. |
Developing web services old-fashioned way could be as cruel. Evidence can be seen on official website of WCF Champ Web Campaign as well as on YouTube in Hi Definition format.
WCF Champ Web Campaign website offers great links to resources for jumpstart with this great framework. The resources are grouped in several categories describing why WCF can be of great use for:
- Individual Developer
- Enterprise
- Web
- and what the future look
Take a look at WCF Champ Web Campaign website. It’s fun and useful.
Note: The analogy between WCF and UFC is done only for fun and shouldn’t be considered in any other way.