How to debug WCF service using HTTP context?

I need to debug the WCF service, but this requires an HTTP context.

I currently have a solution with a WCF service website, when I click on its debugging, it launches and then launches an html page that does not contain a test form.

While starting the project, I tried to start wcftestclient manually and then provided the address of my service, it finds the service, but when I call it, it bypasses the IIS level (or the development server), so httpContext is null ...

What is the correct way to debug a WCF service through an IIS context?

+5
source share
4 answers

WCF HttpContext NULL , WCF IIS; , WCF ASP.NET.

HttpContext, , config (web.config, IIS, app.config ):

<system.serviceModel>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>

( ASP.NET), ( ):

[AspNetCompatibilityRequirements
(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]    
public class MyWCFService : IMyWCFService
{
  ......
}  

RequirementsMode=Allowed ASP.NET, RequirementsMode=Required .

, HttpContext.Current, IIS.

+9

(Visual Studio) IIS.

Visual Studio Debug → Attach to process IIS- Attach to Process.

IIS7 - w3wp.exe, " " " " , .

IIS, .

+1

IIS, aspnet_wp.exe XP w3wp.exe 2003. ..

WCF, WcfTestClient.

, IIS , (, , ).

+1

. . 2 svc.

Web.Config

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

[AspNetCompatibilityRequirements (RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] , .

+1

All Articles