IIS 500 Error WCF Service and Failed Request Tracing not info - wcf

I have a WCF service running in IIS 8.5 on Windows Server 2012 R2 with AppPool Integrated.
I open url in the server: http://localhost:50123/MyService.svc
I have HTTP 500 Internal Server Error. (IExplorer cannot show the page)
I have not found the problem in Event logs, IIS Logs.
I apply this steps: https://peter.hahndorf.eu/blog/iislogging.html
Disable IE “Friendly HTTP error messages”
<customErrors mode=”Off” />
<httpErrors errorMode="Detailed" />
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
I use WCF tracing, but not view the error messsage.
<system.diagnostics>
<sources>
<source name="System.ServiceModel" propagateActivity="true" switchValue="All">
<listeners>
<add name="xmlTraceListener" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="All">
<listeners>
<add name="xmlTraceListener" />
</listeners>
</source>
<source name="System.Net">
<listeners>
<add name="System.Net" />
</listeners>
</source>
<source name="System.Net.HttpListener">
<listeners>
<add name="System.Net" />
</listeners>
</source>
<source name="System.Net.Sockets">
<listeners>
<add name="System.Net" />
</listeners>
</source>
<source name="System.Net.Cache">
<listeners>
<add name="System.Net" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xmlTraceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\Servitelco\Logs\IntegrationLabor\ServiceWcf.svclog" />
<add name="System.Net" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Servitelco\Logs\IntegrationLabor\SystemNet.trace.log" traceOutputOptions="DateTime" />
</sharedListeners>
<switches>
<add name="System.Net" value="Verbose" />
<add name="System.Net.Sockets" value="Verbose" />
<add name="System.Net.Cache" value="Verbose" />
<add name="System.Net.HttpListener" value="Verbose" />
</switches>
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxSizeOfMessageToLog="26214445" />
</diagnostics>
I setup "Failed Request Tracing", for All content, verbose error logging, HTTP errors in range 400-600.
I open fr000001.xml file from %systemdrive%\inetpub\logs\FailedReqLogFiles\W3SVC1
I only view MODULE_SET_RESPONSE_ERROR_STATUS Warning:
ModuleName ManagedPipelineHandler
Notification 128
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification EXECUTE_REQUEST_HANDLER
ErrorCode The operation completed successfully. (0x0)
Error 500:
HttpStatus 500
HttpReason Internal Server Error
and successfully ?
ErrorCode The operation completed successfully. (0x0)
Not more info about the error.
About the error:
I have and WCF Inspector with IDispatchMessageInspector
Like https://patrickdesjardins.com/blog/wcf-inspector-for-logging
The error is about attribute logFileName="c:\log.txt"
If the path exists, all is OK.
If the path NOT exists, I get Http 500 Error.
<extensions>
<behaviorExtensions>
<add name="myLogBehavior"
type="MyServiceA.LogFileBehaviorExtensionElement, MyServiceA" />
</behaviorExtensions>
</extensions>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<MyLogFileBehavior logFileName="C:\Servitelco\Logsxxx\IntegrationLabor\log.txt" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="behavior1">
<myLogBehavior logFileName="c:\log.txt" />
</behavior>
</endpointBehaviors>
This means there is an unhanded exception with in the code.
Event viewer, IIS Logs, WCF tracing, Failed Request Tracing not shown the error message, why? How get the full error message ? OS not logging the error in anyway ?

I had the same problem - 500 error returned to client, no event log error, no custom errors logged from Global.asax, Failed Request Tracing showed MODULE_SET_RESPONSE_ERROR_STATUS Warning for ManagedPipelineHandler.
Solved by adding a Try/Catch at the very highest level of my controller...
<HttpPost>
Public Function Main() As IHttpActionResult
Try
... all logic here...
Return ResponseMessage(New HttpResponseMessage(HttpStatusCode.OK))
Catch Ex As Exception
Errorcl.HandleException(err) 'internal logging of error
Return ResponseMessage(New HttpResponseMessage(HttpStatusCode.InternalServerError))
End Try

Related

WCF Rest Service Error Acess Denied

Created a WCF Rest Service. It works fine with URL like localhost but when access it with 192.168.1.41 (ipaddress) it throws error "Access Denied".
Tried all the suggestions like Permissions, Enabled Tracing (but nothing logged).
Any Suggestions would be appreciated.
<?xml version="1.0"?>
<configuration>
<system.web>
<trust level="Full" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="coTrainServBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="CoTrain.CoTrainService" behaviorConfiguration="coTrainServBehavior">
<endpoint address="rh" binding="webHttpBinding" behaviorConfiguration="web" contract="CoTrain.ICoTrainService" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true" />
<diagnostics>
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"
maxSizeOfMessageToLog="2000"/>
</diagnostics>
</system.serviceModel>
<system.diagnostics>
<trace autoflush="true"/>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing, Error, Warning, Critical" propagateActivity="true">
<listeners>
<add name="messages"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="D:\CoTrainPublished\messages.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<connectionStrings>
<add name="CoTrainEntities" connectionString="metadata=res://*/DAL.CoTrainModel.csdl|res://*/DAL.CoTrainModel.ssdl|res://*/DAL.CoTrainModel.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.1.11;initial catalog=CoTrain;persist security info=True;user id=sa;password=TestServer#123;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
Thanks
Anand

WCF service works with localhost, but not with an IP address

I've looked through the other similar questions, but not been able to resolve my own problem.
I have a WCF service that works if I connect to it with:
http://localhost:35001/SchoolLightService.svc
but not if I use the computer's ip-address (from within the LAN):
http://192.168.1.4:35001/SchoolLightService.svc
The error message is (had to change the ip number (the above one) to "my ip" to please Stackoverflow):
Error: Cannot obtain Metadata from
http://"my ip":35001/SchoolLightService.svc If this is a Windows
(R) Communication Foundation service to which you have access, please
check that you have enabled metadata publishing at the specified
address. For help enabling metadata publishing, please refer to the
MSDN documentation at
http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange
Error URI: http://"my ip":35001/SchoolLightService.svc
Metadata contains a reference that cannot be resolved:
'http://"my ip":35001/SchoolLightService.svc'. There was no
endpoint listening at http://"my ip":35001/SchoolLightService.svc
that could accept the message. This is often caused by an incorrect
address or SOAP action. See InnerException, if present, for more
details. Unable to connect to the remote server No connection
could be made because the target machine actively refused it
"my ip":35001HTTP GET Error URI: http://"my ip":35001/SchoolLightService.svc There was an error
downloading 'http://"my ip":35001/SchoolLightService.svc'.
Unable to connect to the remote server No connection could be made
because the target machine actively refused it "my ip":35001
The web.config looks like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="SLBehavior">
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpGetUrl="" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services >
<service name="SchoolLightWCF.SchoolLightService"
behaviorConfiguration="SLBehavior">
<host>
<baseAddresses>
<add baseAddress="http://192.168.1.4:35001" />
</baseAddresses>
</host>
<endpoint
address="/SchoolLightService"
binding="wsHttpBinding"
contract="SchoolLightWCF.ISchoolLightService"
/>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"
/>
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<diagnostics>
<messageLogging
logMessagesAtTransportLevel="true" logMessagesAtServiceLevel="false"
logMalformedMessages="true" logEntireMessage="true"
maxSizeOfMessageToLog="65535000" maxMessagesToLog="500" />
</diagnostics>
</system.serviceModel>
<system.diagnostics>
<sharedListeners>
<add name="sharedListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\temp\tracelog.svclog" />
</sharedListeners>
<sources>
<source name="System.ServiceModel" switchValue="Verbose, ActivityTracing" >
<listeners>
<add name="sharedListener" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
<listeners>
<add name="sharedListener" />
</listeners>
</source>
<source name="ApplicationLogging" switchValue="Information" >
<listeners>
<add name="sharedListener" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
</system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<connectionStrings>
<add name="SLEntities" connectionString="...not relevant..." />
</connectionStrings>
</configuration>
What am I doing wrong?
I solved it by publishing it to a real IIS server running on the computer. For some reason the built-in web server in Visual Studio didn't cut it.

Implementing Queueing in WCF

I have a simple WCF service which creates a directory at a location specified as a param.
The service is hosted as a Windows service and runs under the administrator account.
The InstanceContextMode is Single and so is the Concurrency.
The method returns a string of the directory location after creating it.
A client is accessing this service from another computer using ASP.NET.
He has a use case, he clicks the button on the page multiple times in a matter of few seconds, like clicking it 5 times in 2 seconds. What's happening is that the service creates only 2 or 3 folders not all 5.
I know that there is a default queueing mechanism in WCF and for my service it's either not working or I haven't written it to use that mechanism.
How do I go about solving this problem.
Here's the ASP.NET code for button click
protected void Button1_Click(object sender, EventArgs e)
{
ClientClass objClientClass = new ClientClass();
string returnValue = string.Empty;
Random random = new Random();
string uid = random.Next().ToString();
returnValue = objClientClass.StartWorkflow(uid);
Label1.Text = returnValue;
}
Here's the app.config of the host:
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="All"
propagateActivity="true">
<listeners>
<add name="traceListener" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging"
switchValue="All"
propagateActivity="true">
<listeners>
<add name="traceListener" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="Traces.svclog" />
</sharedListeners>
</system.diagnostics>
<system.web>
<compilation debug="true"></compilation>
</system.web>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true"
logMessagesAtServiceLevel="false"
logMessagesAtTransportLevel="false"
logMalformedMessages="true"
maxMessagesToLog="5000"
maxSizeOfMessageToLog="2000">
</messageLogging>
</diagnostics>
<behaviors>
<serviceBehaviors>
<behavior name="NewBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceThrottling maxConcurrentCalls="1" maxConcurrentSessions="5" maxConcurrentInstances="5" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="NewBehavior" name="Utilities.WS.SampleWebService.Jobs">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
contract="Utilities.WS.SampleWebService.IJobs" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://00.00.000.00:8732/Utilities.WS.SampleWebService.Jobs" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
Regards.
STEP 1. ping from client (Which is server side ASP.NET code, not the browser), can it reach the machine hosting the WCF service? Firewall sitting between your webserver and where WCF is hosted?
STEP 2. SVC log
Setup svclog from your config file,
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
Then use SvcTraceViewer from command prompt - look for red.
STEP 3. Add some more logging to your operation and see if anything actually executed
http://msdn.microsoft.com/en-us/library/ms732023(v=vs.110).aspx

WCF: How to do "Add Service Reference" to an SSL Service (I'm getting errors)

FooService.svc.cs:
[ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
public interface IFooBar
{
[OperationContract()]
int Add(int num1, int num2);
}
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
public class FooService : IFooBar
{
public int Add(int num1, int num2)
{
return num1 + num2;
}
}
Web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<globalization culture="en-US" uiCulture="en-US" />
<compilation defaultLanguage="c#" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument>
<files>
<add value="index.aspx" />
</files>
</defaultDocument>
</system.webServer>
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
<listeners>
<add name="ServiceModelTraceListener" />
</listeners>
</source>
<source name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
<listeners>
<add name="ServiceModelTraceListener" />
</listeners>
</source>
<source name="System.Runtime.Serialization" switchValue="Verbose,ActivityTracing">
<listeners>
<add name="ServiceModelTraceListener" />
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="App_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp" />
</sharedListeners>
</system.diagnostics>
</configuration>
I published the Files to my server (which has a ssl certificate on it), but when I go to the webpage: https://localhost:443/FooService.svc I get the following error...
The request message must be protected.
This is required by an operation of
the contract
('IFooBar','http://tempuri.org/'). The
protection must be provided by the
binding
('BasicHttpBinding','http://tempuri.org/').
This happens whether I go to the url directly or if I go to Add Service Reference... from within Visual Studio.
Also, if I change the [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)] to [ServiceContract] it works fine.
The default binding for the HTTP transport in WCF 4 is basicHttpBinding. When you set the service contract protection level to encrypt and sign then the binding must also support message level security. Since basicHttpBinding does not support message level security, you need to configure the service manually to wsHttpBinding or change the protocol map as follows:
<system.serviceModel>
<protocolMapping>
<remove scheme="http" />
<add scheme="http" binding="wsHttpBinding" bindingConfiguration="" />
</protocolMapping>
... snip ...
</system.serviceModel>

HTTP Error 500.19 - Internal Server Error The requested page cannot (WCF + REST + IIS7 + SSL)

I am having a "dandy" time trying to get my WCF REST service hosted on IIS with SSL.
Environment: I am testing on a Windows7 box with a local IIS server. I have self-registered a certificate on my dev box and have:
Created a site in IIS for the purposes of exposing this WCF service via HTTPS.
Created an application under this site and named it "api"
Navigated to my site in IIS
Clicked 'Bindings...' in the Actions panel on the right.
Clicked 'Add'
Selected 'https' and selected my certificate.
A lot of the REST plumbing is handled via extensions in WCF using the WcfRestContrib library. While this has been useful from a programming point of view, there is little out there in the way of documentation when something goes wrong.
The error I am currently getting is:
Error Summary
HTTP Error 500.19 - Internal Server Error The requested page cannot
be accessed because the related
configuration data for the page is
invalid. Detailed Error Information
Module IIS Web Core
Notification BeginRequest Handler Not
yet determined Error Code 0x8007000d
Config Error Config
File \?\C:\inetpub\eMobile\api\web.config
Requested
URL https://172.xx.xx.254:443/api
Physical
Path C:\inetpub\eMobile\api Logon
Method Not yet determined Logon
User Not yet determined
Config Source
-1:
0:
I am really not surew what I am doing wrong here. So far I have tried resenting feature delegation for my site but that didn't work. Any ideas? Anything look odd in my web.config?
Thanks.
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="e1ConnectionString" connectionString="Data Source=USSV112;Initial Catalog=e1;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="e2ConnectionString" connectionString="Data Source=USSV112;Initial Catalog=e2;Integrated Security=True"
providerName="System.Data.SqlClient" />
<system.web>
<httpRuntime maxRequestLength="204800" executionTimeout="3600"/>
<compilation debug="true" targetFramework="4.0">
</compilation>
<httpModules>
<add name="ServiceAnonymityModule" type="WcfRestContrib.Web.ServiceAnonymityModule, WcfRestContrib, Version=1.0.6.107, Culture=neutral"/>
</httpModules>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.webServer>
<rewrite>
<rules>
<rule name="Users" stopProcessing="true">
<match url="^rest/users/(.*)$"/>
<action type="Rewrite" url="rest/Users.svc/{R:1}" />
</rule>
</rules>
</rewrite>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ServiceAnonymityModule"/>
<add name="ServiceAnonymityModule" type="WcfRestContrib.Web.ServiceAnonymityModule, WcfRestContrib, Version=1.0.6.107, Culture=neutral"/>
</modules>
</system.webServer>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="messages" type="System.Diagnostics.XmlWriterTraceListener" initializeData="d:\Temp\WcfRestContribErrors.log" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="messages" type="System.Diagnostics.XmlWriterTraceListener" initializeData="d:\Temp\WcfRestContribMessages.log" />
</listeners>
</source>
</sources>
<trace autoflush="true"/>
</system.diagnostics>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<extensions>
<behaviorExtensions>
<add name="webAuthentication" type="WcfRestContrib.ServiceModel.Configuration.WebAuthentication.ConfigurationBehaviorElement, WcfRestContrib, Version=1.0.6.107, Culture=neutral, PublicKeyToken=89183999a8dc93b5" />
<add name="errorHandler" type="WcfRestContrib.ServiceModel.Configuration.ErrorHandler.BehaviorElement, WcfRestContrib, Version=1.0.6.107, Culture=neutral, PublicKeyToken=89183999a8dc93b5" />
<add name="webFormatter" type="WcfRestContrib.ServiceModel.Configuration.WebDispatchFormatter.ConfigurationBehaviorElement, WcfRestContrib, Version=1.0.6.107, Culture=neutral, PublicKeyToken=89183999a8dc93b5" />
<add name="webErrorHandler" type="WcfRestContrib.ServiceModel.Configuration.WebErrorHandler.ConfigurationBehaviorElement, WcfRestContrib, Version=1.0.6.107, Culture=neutral, PublicKeyToken=89183999a8dc93b5" />
</behaviorExtensions>
</extensions>
<bindings>
<customBinding>
<binding name="HttpStreamedRest">
<httpTransport maxReceivedMessageSize="209715200" manualAddressing="true"/>
</binding>
<binding name="HttpsStreamedRest">
<httpsTransport maxReceivedMessageSize="209715200" manualAddressing="true"/>
</binding>
</customBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="Rest">
<webAuthentication authenticationHandlerType="WcfRestContrib.ServiceModel.Dispatcher.WebBasicAuthenticationHandler, WcfRestContrib"
usernamePasswordValidatorType="Engage.Mobile.WebServices.Runtime.SecurityValidator, Engage.Mobile.WebServices"
requireSecureTransport="false" source="E Mobile" />
<webFormatter>
<formatters defaultMimeType="application/json">
<formatter type="WcfRestContrib.ServiceModel.Dispatcher.Formatters.PoxDataContract, WcfRestContrib"
mimeTypes="application/xml,text/xml" />
<formatter type="WcfRestContrib.ServiceModel.Dispatcher.Formatters.DataContractJson, WcfRestContrib"
mimeTypes="application/json" />
<formatter type="WcfRestContrib.ServiceModel.Dispatcher.Formatters.FormUrlEncoded, WcfRestContrib"
mimeTypes="application/x-www-form-urlencoded" />
</formatters>
</webFormatter>
<errorHandler errorHandlerType="WcfRestContrib.ServiceModel.Web.WebErrorHandler, WcfRestContrib" />
<webErrorHandler logHandlerType="Engage.Mobile.WebServices.Runtime.LogHandler, Engage.Mobile.WebServices" returnRawException="true" exceptionDataContractType="" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
It looks very much like this thread
The proposed answer was
Right click the folder where your site is located: "C:\Users\NAME\SiteName" and selecting Properties
Select the Security tab and click on Edit
Add.. and type in "IIS_IUSRS"
I posted a similar answer in this thread, and there are similar answers across SO for these errors.
You have a rewrite element in your web.config, and without URL Rewrite installed IIS does not recognise this element and throws the error you currently see. Install URL Rewrite and this should work.
You can try enabling tracing on your service to see if the request is reaching the service or failing on IIS itself. If it is reaching your service then tracing would pick up the exact error on where it is failing. To enable tracing follow this link