WCF Service Library vs Class Library project types
Asked Answered
M

4

23

What does a WCF Service Library do that a regular class library doesn't?

Edit: I posted my own answer. Am I missing anything? Are they fundamentally both just class libraries with a few template classes added?

Markson answered 12/3, 2010 at 18:31 Comment(1)
@qntmfred: "Are they fundamentally both just class libraries with a few template classes added", everything is pretty much just a class library project with template classes and other settings added.Ioved
M
25

I created both and compared. This is what I found.

WCF Service Library

  • adds references to System.Runtime.Serialization and System.ServiceModel. does not contain a reference to System.Data.DataSetExtensions as the Class Library does.
  • contains sample service classes IService1, CompositeType and Service1
  • adds app.config with a wsHttpBinding and a mexHttpBinding service endpoint
  • adds /client:"WcfTestClient.exe" as a debug command line option in the project properties
  • adds a WCF Options tab in the project properties. This tab contains an option to start a WCF service host when debugging another project in the same solution
  • enables a Sign the ClickOnce manifests option in the Signing tab of the project properties. this option is disabled in the Class Library
Markson answered 12/3, 2010 at 18:50 Comment(1)
that nicely sums up what the WCF Service Library does, indeed !Prostatitis
I
5

It also runs the WCF Service Host utility on F5. The /client switch that you noticed is being passed to the WCF Service Host to tell it which client to launch. In this case, it is being told to launch the WCF Test Client.

This gives you a pretty good F5 experience. Set breakpoints in your service, hit F5, use the Test Client to invoke your service operation, and your breakpoints will be hit.

Ioved answered 12/3, 2010 at 19:16 Comment(2)
@Marc: I was in too much of a hurry. Check the edit to see what I was getting at (that the /client switch is passed to the test host so that it can launch the client)Ioved
@Benny: that's just <kbd>F5</kbd>. For occasional use only.Ioved
D
2

I have tested in VS 2010 project, using class library as WCF Hosting type, but it fails to generate wsdl or proxy classes.

WCF project is different than normal class library, because it adds many dlls in solution/project references and also it adds (Service1.svc) template, which you need to deploy in IIS server and to create 2 output files using svcutil.exe.

Dishwater answered 24/9, 2010 at 6:50 Comment(0)
S
0

As described here:

In the first PropertyGroup element do the following:

Look for the ProductVersion element. Update the product version to match the following:

<ProductVersion>8.0.50727</ProductVersion>

Below the AssemblyName element, add the following elements:

<ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

<StartArguments>/client:"WcfTestClient.exe"</StartArguments>

Scroll to the end of the file, and below the Import element add the following extension:

<ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{3D9AD99F-2412-4246-B90B-4EAA41C64699}">
        <WcfProjectProperties>
          <AutoStart>True</AutoStart>
        </WcfProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
Showker answered 11/2, 2014 at 10:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.