8

I host 2 WCF web services and 1 standard .NET web service from an application directory. The .NET service and 1 of the WCF services works perfectly; however, the other WCF service is returning the following error:

The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as 'Allowed' or 'Required'.

Both WCF web services have the line

<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _

and the web.config file has

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

To add more confusion to the mix, when I change

AspNetCompatibilityRequirementsMode.Allowed

to

AspNetCompatibilityRequirementsMode.Required

the service works just fine.

Also, changing

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

to

<serviceHostingEnvironment aspNetCompatibilityEnabled="false" />

in the web.config also allows all web services to function.

This problem is presenting on both IIS7 and our staging enviorment hosted on SBS2003 running IIS6.

Thank you in advance for all of your help.
Jake

UPDATE:
I was able to get it to work by deleting the application on my development system; however, the problem still persists on our staging server, even after deleting the application and recreating it there.

WORK AROUND:

  1. Delete the Application from IIS
  2. Recreate the direcotry
  3. Create a New Application Pool
  4. In the properties of the direcotry, create the Application and associate it to the new Application Pool.

What a pain.

2
  • 1
    Post this as answer and mark it as answer please. Apr 28, 2011 at 19:41
  • This is not the answer. This is simply a horrible work around, and the problem has once again presented itself on my live server. Does anyone have a true solution to this problem, or any idea what is causing this? Jun 21, 2011 at 18:25

2 Answers 2

3

You can not host 2 different framework version of service under single application pool. What i mean is that if you have hosted 2 WebService ( One is using Framework 2.0 and another is using framework 4.0) under single application pool, any one service will work. Second will never work

SOLUTION:

    Create 2 different application Pool. App1 (Target Framework 2.0) and App2 (Target Framework 4.0)
    Assign App1 pool to that service which developed in Framework 2.0.
    Assign App2 pool to that service which developed in Framework 4.0.
    Restart IIS

It should work now.

1
  • Thanks for the reply Ashu; unfortunately, both projects point to the 3.5 framework. This is confirmed since after recreating the Application in IIS, both web services run off of the same AppPool. May 23, 2011 at 15:09
0

WORK AROUND:

  • Delete the Application from IIS
  • Recreate the direcotry
  • Create a New Application Pool
  • In the properties of the direcotry, create the Application and associate it to the new Application Pool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.