1

I'm writing a WCF application exposing two methods.

What I need is to exclude a method when to deploy on IIS because the method is only used when to investigate a service for tests.

Instead of doing it by hands I want to achieve it automatically.

How can it be possible?

3 Answers3

1

Try add this on the method for debug

 #if DEBUG
    [OperationContract]
 #endif

Then you have to compile in release mode.

bangoo
  • 668
  • 1
  • 8
  • 14
0

Perhaps this might be of use: http://msdn.microsoft.com/en-us/library/4y6tbswk.aspx ?

Also see also this for when #DEBUG is defined: https://stackoverflow.com/a/2104121/2462779 .

Community
  • 1
  • 1
NarTh
  • 16
  • 2
0

Use two service interface: one with the method and one without it. Then expose the appropriate one to your clients.

Jocke
  • 2,189
  • 1
  • 16
  • 24