Issues hosting WCF web service object in IIS

  • Thread starter Thread starter JDeats
  • Start date Start date
J

JDeats

Hey group,

I have two things:

1. I'm trying to get my head around the real advantages of using WCF
web services as opposed to good-ol .asmx files. In less than five
minutes I can create a simple Hello World SOAP web service inside
an .asmx decorate my methods with [WebMethod], set a web reference
from another project and we're rolling

For WCF web services, I have to create a class library to house my
service, create an interface to house the Service/Operation Contracts,
create a static class for my templates, create transport classes...
Then create a console application to house my WebServiceHost. So the
effort here is multiplied many times and I guess I'm not understanding
why the development tools couldn't abstract all this a bit and what
the strong advantages are for incurring this additional effort as
billable time.


2. In my scenario I need to have ASP.NET compatibility set on my WCF
service
So I'm setting a reference to System.Web and adding this attribute to
my class
[AspNetCompatibilityRequirements(RequirementsMode =
AspNetCompatibilityRequirementsMode.Allowed)]

Great...

Now my problem is getting this thing hosted in IIS. I've created the
required .svc and created a web.config with the binding attributes
(again, why isn't there code generation tools for all this built into
VS.NET 2008? I digress). I guess I have two questions.

A. Aside from creating the .svc and web.config and putting these two
files in the directory along with your .DLLs is there any other
configuration that has to occur inside IIS? I've created a new
application and pointed it to my folder, but that's it.

For example:
http://localhost/myservice/service.svc/mycollection/collectionname/xml

Returns an IIS error.


B. Once a WCF service is deployed to IIS is there any way to attach to
this process and step-through debug?


Thanks in advance and I'm sorry if this is in the wrong group....
Answers greatly appreciated
 
JDeats said:
Hey group,

I have two things:

1. I'm trying to get my head around the real advantages of using WCF
web services as opposed to good-ol .asmx files. In less than five
minutes I can create a simple Hello World SOAP web service inside
an .asmx decorate my methods with [WebMethod], set a web reference
from another project and we're rolling

For WCF web services, I have to create a class library to house my
service, create an interface to house the Service/Operation Contracts,
create a static class for my templates, create transport classes...
Then create a console application to house my WebServiceHost. So the
effort here is multiplied many times and I guess I'm not understanding
why the development tools couldn't abstract all this a bit and what
the strong advantages are for incurring this additional effort as
billable time.

I attended a seminar back in April 2009 for .Net Developers using WCF in
solutions, all transport mechanisms of WCF. The bottom line is non WCF Web
service solutions are being leveraged out/depreciated in future versions of
VS and the .Net Framework in favor of WCF. MS's efforts will be on WCF and
all forms of communications transport. Also, .NET remoting is being
leveraged out as well.

The reasoning being is that WCF is abstracting a lot of the
inter-working/plumbing of program communications with another program with
MS's continued development of WCF as a the primary communications solution
in .NET.
2. In my scenario I need to have ASP.NET compatibility set on my WCF
service
So I'm setting a reference to System.Web and adding this attribute to
my class
[AspNetCompatibilityRequirements(RequirementsMode =
AspNetCompatibilityRequirementsMode.Allowed)]

Great...

Now my problem is getting this thing hosted in IIS. I've created the
required .svc and created a web.config with the binding attributes
(again, why isn't there code generation tools for all this built into
VS.NET 2008? I digress). I guess I have two questions.

VS 2008 does make the config file on the client side when a Service
reference is made to the WCF Web service in the project of either and app or
web.config, depending upon the client application. There is also a nice
little in VS 2008, that will allow you to right-click the wcf.config file
and edit it a formalized manner.
A. Aside from creating the .svc and web.config and putting these two
files in the directory along with your .DLLs is there any other
configuration that has to occur inside IIS? I've created a new
application and pointed it to my folder, but that's it.

No, other than using the correct user account for the virtual directory
access.
For example:
http://localhost/myservice/service.svc/mycollection/collectionname/xml

Returns an IIS error.


B. Once a WCF service is deployed to IIS is there any way to attach to
this process and step-through debug?

By enabling Debug = true in the Web.config, just like you would do for any
other Web service application and by having a test harness that's going to
allow you to step into code, which can be done with tools like Reshaper,
MBUnit and Gallio using a Classlib project that has a service reference to
the WCF Web service. You can step into the WCF Web service code.

There is also these tools as well.
http://www.codeproject.com/KB/WCF/WCF35Utils.aspx

There is also ASP.NET Dataservice, which a cutdown WCF Web service solution
that has a one line entry in a WEB solution pointing the .svc file, which
uses REST -- use Google and look it up.



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4139 (20090608) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
Back
Top