I receive the following request error from my WCF Rest web service when using forms Authentication and Authorization. It works fine without the Authentication and Authorization:-
"The server encountered an error processing the request. Please see the service help page for constructing valid requests to the service."
Its built in .net 4 so no .svc file, here is the service code:--
namespace WcfRestService1
{
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class Service1
{
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public string GetHelloMessage()
{
return ("hello from web service");
}
}
}
Here is the web config code:--
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<standardEndpoint name="" helpEnabled="true" crossDomainScriptAccessEnabled="true" defaultOutgoingResponseFormat="Json" automaticFormatSelectionEnabled="true"/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
<system.web>
<authentication mode="Forms">
<forms defaultUrl="Service1" timeout="20"
ticketCompatibilityMode="Framework40"
loginUrl="login.aspx" name=".Mobile-Rest-Api" cookieless="UseCookies"/>
</authentication>
<authorization>
<deny users="?" />
<allow users="*"/>
</authorization>
<!--<authentication mode="None"/>-->
</system.web>
<location path="login">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
</configuration>
Any help on this would be great, thanks in advance.