Showing posts with label WCF. Show all posts
Showing posts with label WCF. Show all posts

Saturday, March 29, 2008

Visual Studio 2008 and .NET Framework 3.5 Training Kit

Microsoft released a nice training kit (~126MB) (it's a real treasure!) for the latest technologies.

This package covers a bunch of technologies and includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2008 features and a variety of framework technologies vs2008 training kitincluding:

  • Visual Studio Tools for Office
  • Visual Studio Team System
  • Application Lifecycle Management
  • C# 3.0
  • VB 9.0
  • LINQ
  • WPF
  • WCF
  • WF
  • Silverlight
  • ASP.NET
  • AJAX
  • CardSpace
  • Mobile

 

Download here.

Thursday, February 28, 2008

WCF Impersonation With Client

If you have a service that uses Windows authentication and you want to impersonate the caller you need to configure the client and the server.

This is the client proxy. You need to give it the correct credentials.

client.ClientCredentials.Windows.ClientCredential.Domain = "DOMAINName";
client.ClientCredentials.Windows.ClientCredential.UserName = "UserName";
client.ClientCredentials.Windows.ClientCredential.Password = "Password";
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;


The server side looks like this:



using (ServiceSecurityContext.Current.WindowsIdentity.Impersonate())
{
...
}


This impersonate part of the method. This property impersonate all method:



[OperationBehavior(Impersonation = ImpersonationOption.Required)]

Tuesday, February 26, 2008

Client Impersonation in WCF

Recently I got a question about impersonation in WCF. What should we do in order to impersonate the client?

It's simple:

Client Side

// Create a client with given client endpoint configuration
MyServiceClient client = new MyServiceClient();
client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;


Server Side



if (ServiceSecurityContext.Current.WindowsIdentity.ImpersonationLevel == TokenImpersonationLevel.Impersonation ||   ServiceSecurityContext.Current.WindowsIdentity.ImpersonationLevel == TokenImpersonationLevel.Delegation)
{
// Impersonate.
using(ServiceSecurityContext.Current.WindowsIdentity.Impersonate())
{
Console.WriteLine("Impersonating the caller");
}
}

Friday, September 28, 2007

svcutil.exe in Orcas Beta 2 problem

Posted also at: Maor David - The Blog.

When I trying to run WCF test service on VS 2008 beta 2 I got an error:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly ’svcutil, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0×8013141A)

File name: ’svcutil, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ —> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0×8013141A)

It turns out that this is a known issue in Beta2. Svcutil.exe is not signed correctly.

I found a solution for this issue at WCF MSDN forum: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1932994&SiteID=1&pageid=0

The solution is:

1. Open the VS 2008 Beta 2 command prompt as Administrator (important especially in Vista).

2. Browse to the bin directory of the windows SDK ([C]:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin)

3. Type: sn –Vr svcutil.exe.

 

By the way,  sn -Vr will not sign it but rather tell .NET to skip signature verification for that assembly.

Technorati Tags: ,

Thursday, June 21, 2007

WCF performance - Is it really better?

MSDN introduce a Performance Comparison of Windows Communication Foundation (WCF) with Existing Distributed Communication Technologies.

The conclusion is that "WCF is 25%-50% faster than ASP.NET Web Services, and approximately 25% faster than .NET Remoting. Comparison with .NET Enterprise Service is load dependant, as in one case WCF is nearly 100% faster but in another scenario it is nearly 25% slower. For WSE 2.0/3.0 implementations, migrating them to WCF will obviously provide the most significant performance gains of almost 4x."

You can fine the entire comparison here.

Saturday, May 26, 2007

Enterprise Library 3.1 Released

Enterprise Library 3.1 just Released: It is a maintenance release to fix a few bugs. It also includes an extension point in the Policy Injection Application Block that allows you to replace the injection mechanism.

Changes per Tom Hollander:

Policy Injection Application Block

  • The default Remoting Policy Injector can now be replaced with alternative interception mechanisms via configuration without modifying the application block code
  • Call Handler attributes are now honored correctly when placed on interface methods
  • Fixed an issue that could cause duplicate handlers where matching rules matched both a class and its interface
  • Classes implementing COM interfaces (including those deriving from System.Windows.Forms.Form) can now be intercepted
  • TraceLogEntry class is now serializable, allowing it to be used with the MSMQ Trace Listener

Validation Application Block

  • Fixed an issue that prevented the PropertyComparisonValidator from working with the Windows Forms integration adapter
  • The message template for the PropertyComparisonValidator can now be saved using the configuration tools.

Data Access Application Block

  • Connection strings for OLEDB and ODBC connections can now be edited using custom dialog boxes from the configuration tools

You can download it here.

Friday, May 18, 2007

WCF Articles

In order to introduce Windows Communication Foundation (WCF) I'm starting a series of posts here.

Most of the applications now requires to support the SOA architecture, means that the application should provide a service interfaces to be exposed to other applications. These interfaces can be exposed using many technologies: Web Services, COM+ and so on. Each technology is completely defferent from the other, and requires special knowledge of coding.

WCF makes life better. WCF helps developers to expose service interfaces using any technology. WCF has same set of functions and attributes that will be used for all technologies (bindings).

From every post I'll refer to this post and I'll keep a TOC here so you can easily navigate in the blog.

TOC:

  1. What is service ABC? Basic client/Server application.