Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Service Configuration Problem

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.

like image 716
Jacob Hulse Avatar asked Apr 27 '11 16:04

Jacob Hulse


1 Answers

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.

like image 58
ashu Avatar answered Sep 22 '22 12:09

ashu