I searched, trying to solve the problem that I encountered with WCF. I am very new to WCF, so I was not sure what was going on.
I am using Visual Studio 2010 and New Web Site-> WCF Service. I created my service also in the configuration file, if I set aspNetCompatibilityEnabled="true" , I would get this error when accessing the service through my web browser.
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'.
I do not understand what it means. Why aspNetCompatibilityEnabled="true" cause this error when [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)] fixes it.
I think they are doing the same thing. Also, without this attribute, Silverlight could not call my WCF methods. Why is this?
Here is my configuration file, if necessary:
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> <customErrors mode="Off"/> </system.web> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="LargeBuffer" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" /> </basicHttpBinding> </bindings> <services> <service name="Services.Exporter"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeBuffer" contract="Services.IExporter" /> </service> </services> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration>
So my question is: why add a compatibility attribute? Also, why is it necessary for Silverlight?
Justin Mar 20 2018-12-12T00: 00Z
source share