Welcome to MSDN Blogs Sign
in | Join
| Help

Sajay Antony

.NET and more about .NET

RSS 2.0

Home

About

Email

<

August 2006

>

Su

Mo

Tu

We

Th

Fr

Sa

30

31

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

1

2

3

4

5

6

7

8

9

Search
Go

Archives

August 2006
(2)

July 2006
(6)

June 2006
(3)

May 2006
(7)

April 2006
(3)

March 2006
(8)

February 2006
(2)

News

This posting is provided "AS IS" with no warranties, and confers no
rights.

www.flickr.com

More of Sajay Antony's
photos

Post Categories

.NET Framework
(3)

Asp.net (2)

Personal
(1)

VSTS (0)

Windows
Mobile/CF (1)

WinFX (4)

WS-* and WCF
(15)

MGSI Bloggers

Tarun Kohli

Sanket Bakshi

My Sites

Personal Space

Great Bloggers

Brad Abrams

Don Box

Yasser Shohoud

Monday, August 07, 2006 2:40 AM Sajay

WCF Service with .asmx extentions

We already have quite a large number of ASMX services and clients. One major
point to be kept in mind is that WCF and asmx services can co-exist without any
problem and migration to WCF should be your first and only
choice unless there is a reason like using security that you do not have
already. Or other WS protocols that you need for expanding your serivce.

When migrating there are a number of scenarios one can encounter. One of them
is moving an asmx service to WCF withouth changing the undelying client. This
would also include not changing the endpoint address to which the client talks
to. Now if the client points to something like http://MyServer.com/Service.asmx how
can you make this a WCF service? There are 2 main scenarios when doing this.

Without AspNetCompatibility mode.

This is a rather strainght forward approach and can be achieved through the
following steps.

1.
Add a service host file called service.asmx with the
following

<%@ServiceHost
language=c# Debug="true" Service="WCFAspCompat.service1" %>

2.
Add the following to your web.config file

<system.web>

<compilation>

<buildProviders>

<remove
extension=".asmx"/>

<add
extension=".asmx" type="System.ServiceModel.Activation.ServiceBuildProvider,
System.ServiceModel, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
/>

</buildProviders>

</compilation>

</system.web>

With
AspNetCompatibility

This requires one more
configuration for the httpHandlers and can be achieved with the following
steps.

1.
Add a service host file called service.asmx with the
following

<%@ServiceHost
language=c# Debug="true" Service="WCFAspCompat.service1" %>

2.
You have to remove the .asmx handler initially. Add
the following to you Web.config to get this working.

<system.web>

<httpHandlers>

<remove
path="*.asmx" verb="*"></remove>

<add
path="*.asmx" verb="*" type="System.ServiceModel.Activation.HttpHandler,
System.ServiceModel, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"

validate="false"
/>

</httpHandlers>

<compilation>

<buildProviders>

<remove
extension=".asmx"/>

<add
extension=".asmx" type="System.ServiceModel.Activation.ServiceBuildProvider,
System.ServiceModel, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
/>

</buildProviders>

</compilation>

</system.web>

3.
Get your service setup as a aspNet Compatibile
service
refer this
post.

Filed Under: Asp.net, WS-* and
WCF

Comment Notification

If you would like to receive an email when updates are made to this post,
please register here

You can also stay up to date using your favorite aggregator by subscribing to
the CommentRss
Feed

Comments

No Comments

What do you think?

Name
(required)*

Your URL
(optional)

Comments
(required)*

Remember Me?