background preloader


Facebook Twitter

Dan Rigsby » Don’t Wrap Wcf Service Hosts or Clients in a Using Statement. Ok, this article is going to go against everything your mother taught you about cleanly disposing of your objects.

Dan Rigsby » Don’t Wrap Wcf Service Hosts or Clients in a Using Statement

Didn’t she always say, “Always dispose of your resources when you are finished with them. And scope it with a using statement if you can!”? My mother practically beat that into me growing up and she would probably disown me if she read this post. So at first glace I would think that this is how I might create a service and client in Wcf: using (ServiceHost serviceHost = new ServiceHost( typeof (MyService), new Uri( " ))) { serviceHost.Open(); } using (ChannelFactory<IMyService> channelFactory = new ChannelFactory<IMyService>()) { channelFactory.Open(); } Don’t tell your mother, but I’m going to tell you right now, “ Don’t do this!

Now one comment you might have is, “Dan, I don’t see a Dispose method on the ServiceHost or ChannelFactory anyway.” If your call to Open() on the service host fails, then the finally block will still be executed. XML and ADO.NET Types in Data Contracts. The XmlElement type is serialized using its XML contents.

XML and ADO.NET Types in Data Contracts

For example, using the following type. [DataContract(Namespace=@" public class MyDataContract { [DataMember] public XmlElement myDataMember; public void TestClass() { XmlDocument xd = new XmlDocument(); myDataMember = xd.CreateElement("myElement"); myDataMember.InnerText = "myContents"; myDataMember.SetAttribute ("myAttribute","myValue"); } } Windows Communication Foundation Tools. Microsoft Windows Communication Foundation (WCF) tools are designed to make it easier for you to create, deploy, and manage WCF applications.

Windows Communication Foundation Tools

This section contains detailed information about the tools. Please note that the tools are not supported. You can run all the tools from the command line. The following table lists these tools and provides a brief description. All the preceding tools except ServiceModelReg.exe, WsatConfig.exe and ComSvcConfig.exe ship with the Windows SDK, and can be found under the C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin folder. WCF Troubleshooting Quickstart. The full error message is: HTTP Error 404.3 – Not FoundThe page you are requesting cannot be served because of the extension configuration.

WCF Troubleshooting Quickstart

If the page is a script, add a handler. If the file should be downloaded, add a MIME map. Detailed Error InformationModule StaticFileModule. This error message occurs when “Windows Communication Foundation HTTP Activation” is not explicitly set in the Control Panel. Depending upon the exception, there may be several issues: It is highly recommended that you create your own custom error data type and declare that as the detail type in your fault contract. WCF: Instance Management Techniques For Developing WCF Apps. WCF Essentials Discover Mighty Instance Management Techniques For Developing WCF Apps Juval Lowy.

WCF: Instance Management Techniques For Developing WCF Apps

Using the Message Class. When you need an alternative way of creating outgoing message contents (for example, creating a message directly from a file on disk) instead of serializing .NET Framework objects.

Using the Message Class

When you need an alternative way of using incoming message contents (for example, when you want to apply an XSLT transformation to the raw XML contents) instead of deserializing into .NET Framework objects. When you need to deal with messages in a general way regardless of message contents (for example, when routing or forwarding messages when building a router, load-balancer, or a publish-subscribe system). The operation cannot have any out or ref parameters. There cannot be more than one input parameter. If the parameter is present, it must be either Message or a message contract type. The following code example contains a valid operation contract. [ServiceContract] public interface IMyService { [OperationContract] Message GetData(); [OperationContract] void PutData(Message m); } Using Sessions. If you use the default instancing behavior in WCF, all calls between a WCF client object are handled by the same service instance.

Using Sessions

Therefore, at the application level, you can think of a session as enabling application behavior similar to local call behavior. For example, when you create a local object: A constructor is called. All subsequent calls made to the WCF client object reference are processed by the same object instance. Just Released: Web Service Software Factory for WCF! - Tom Hollander's blog. <serviceDebug> Specifies debugging and help information features for a Windows Communication Foundation (WCF) service.


The following sections describe attributes, child elements, and parent elements. Attributes Child Elements None. Parent Elements You can also set httpsHelpPageEnabled and httpsHelpPageUrl to enable or disable the help page. The optional httpHelpPageBinding and httpHelpPageBinding attributes allow you to configure the bindings used to access the service web page. Build Date: Service Station: WCF Messaging Fundamentals. Service Station WCF Messaging Fundamentals Aaron Skonnard Code download available at:ServiceStation2007_04.exe(161 KB) When you start pulling the layers away from Windows® Communication Foundation, you find a sophisticated XML-based messaging framework that offers a world of possibilities when connecting systems using a variety of protocols and formats.

Service Station: WCF Messaging Fundamentals

In this month's column, I am highlighting some of the key messaging features we can thank for such flexibility. This column assumes a basic understanding of the Windows Communication Foundation programming model. One of the primary goals of the Windows Communication Foundation messaging architecture is to provide a unified programming model while also allowing flexibility in how data is represented and messages are transmitted. Peer-to-Peer Networking. Peer Channel is a multiparty, peer-to-peer (P2P) communication technology in Windows Communication Foundation (WCF).

Peer-to-Peer Networking

It provides a secure and scalable message-based P2P communication channel for application developers. One common example of a multiparty application that can benefit from Peer Channel is a collaborative application, such as chat, where a group of people chat with one another in a peer-to-peer manner without servers. Peer Channel enables P2P collaboration, content distribution, load balancing, and distributed processing for both consumer and enterprise scenarios. Peer Channel is enabled by default on Windows Vista, as is all of WCF. To access Peer Channel classes, add references to System.ServiceModel.dll to your project. This message cannot support the operation because it has been copied - Nicholas Allen's Indigo Blog.

Has this error message happened to you? It's because the lifetime of a message only lasts for one use. Once you've looked at the contents of a message, or copied the contents somewhere, you can't read the message again. This is a common problem encountered when people are trying to write a message inspector. Since you're expected to pass the message along after you're done inspecting it, it's quite likely that you'll need to make a new copy of the message. If you don't make a copy of the message, then the next person will have nothing to read. This means that your message inspector code should look something like this: public void AfterReceiveReply(ref Message reply, object correlationState){ MessageBuffer buffer = reply.CreateBufferedCopy(MaxMessageSize); // Do something with the copied message reply = buffer.CreateMessage(); buffer.Close(); } Nicholas Allen's Indigo Blog. Matevz Gacnik's Weblog - WCF: Reliable Message Delivery.

Windows Communication Foundation includes concepts which enable the developer to insist on reliably delivering messages in both directions. The mechanism is actually transport agnostic and allows messages to be flown reliably from client to service and replies from service to client. Underneath, WS-ReliableMessaging (WS-RM) implementation is used. Click here for Microsoft's specification. Content is the same. How to: Host and Run a Basic Windows Communication Foundation Service. This topic describes how to host a Windows Communication Foundation (WCF) service in a console application.

This procedure consists of the following steps: Create a console application project to host the service. Create a service host for the service. Enable metadata exchange. Open the service host. A complete listing of the code written in this task is provided in the example following the procedure. To create a new console application to host the service Create a new Console Application project by right-clicking on the Getting Started solution, selecting, Add, New Project. To host the service. How to: Publish Metadata for a Service Using a Configuration File. Consume WCF BasicHttpBinding Services from ASMX Clients.

The interoperability of WCF services has been touted quite a bit: just expose an endpoint using BasicHttpBinding and you will have a WS-I Basic Profile adherent web-service. This is of course backed by some simple examples of math services, all RPC-style and none of them messaging-style services. Versioning Windows Communication Foundation Services - Craig McMurtry's WebLog. To show how to properly deal with versioning, I’ve created a versioning decision tree. It shows you what you will need to do to handle every case, and it also shows you the consequences of each versioning choice you might make. Blog Archive » A Sample IWsdlExportExtension for WCF. I've been playing for a few hours with implementing an IWsdlExportExtension for Windows Communication Foundation in RC1, and thought some of you might be interested in this little sample.

WCF and WSDL. I've recently started using WCF to develop Web Services. Clemens Vasters - Saturday, February 26, 2005. [Read Part 1 and Part 2 first] Like with parts 1 and 2, I’ll stick with the “this isn’t RPC” theme for this 3rd part of this little series and will show how to flow free form XML from and to services. However, I will drop the “client”/”server” nomenclature from here on and will talk about endpoints. If you look at the contract below (along with the following explanation, of course), you’ll quickly figure out why – both parties in the “buyer”/”seller” conversation I am declaring in the contract below, act as client and as server at the same time.

In contrast to the previous two examples, I am not using the raw Message class, but I move one notch up on the messaging stack and use the XmlSerializer formatting mode for Indigo, which allows me to flow the contents of an XmlNode between services just like it can be done today with ASP.NET Web Services. Clemens Vasters - A Weekend With Indigo. Part 1: Simple Messaging.

Improving WCF Interoperability: Flattening your WSDL - Christian Weyer's Blog. WCF is surely a big step forward for having a unified communication runtime, API and hosting model. And with all these super-exciting specifications and standards supported WCF must be a killer when it comes to interoperability with other platforms, technologies, stacks. And now the communication gurus from Redmond even announced that they will support everything to imagine (OK, except CORBA, ICE and Remoting wire interop ;)) under the big communication umbrella - including popular rockstars like REST-style architectures, RSS- and Atom-driven feeds and JSON for the AJAXians. Oh, and of course they still love SOAP. How to: Callback function with WCF - .net ready !!! The goal is to inform the client that the server process has progressed: WCF Streaming: Upload files over HTTP. We have a web application that requires a robust and reliable document upload mechanism for very large files, and are currently using Microsoft BITS technology to achieve this.

Using Message Contracts. WCF supports operations modeled on either the remote procedure call (RPC) style or the messaging style. In an RPC-style operation, you can use any serializable type, and you have access to the features that are available to local calls, such as multiple parameters and ref and out parameters. In this style, the form of serialization chosen controls the structure of the data in the underlying messages, and the WCF runtime creates the messages to support the operation. This enables developers who are not familiar with SOAP and SOAP messages to quickly and easily create and use service applications.

AddressAccessDeniedException – Cause and Solution - Amit Lale's blog. While working with WCF service on Windows Vista, I came across the following error, which I am sure everybody who have created the services on previous versions (Windows XP and likes) and trying to migrate their services to Windows Vista would have encountered. Data Contract Schema Reference. Service Station: Serialization in Windows Communication Foundation. WCF with Transport security and self-signed certificate. WCF-Creating Self-Signed Certificates - Damir Dobric Posts - WCF "Raw" programming model (Web) - receiving arbitrary data - Carlos' blog. REST in Windows Communication Foundation (WCF) How to: Create Temporary Certificates for Use During Development. Restws.pdf (application/pdf Object)

Explaination of different timeout types. Clients and the Automatic Help Page in WCF WebHttp Services - The .NET Endpoint.