WCF Data Services – Debugging

I have been building some data services that are used to connect too Oracle data sources. Everything worked fine within VS 2010 but on pushing my service to IIS locally and remotely I was getting error 500’s. I managed to solve the issues locally without to much trouble but on the remote server I really couldn’t for the life of me see what was going on. By default there was really very little in the way of debugging information.

ISSUE 1:

My First issue was error 500’s with no real logging. To find out what is happening here I used tracing. If you add the following to your web.config you will get some nice trace information:

<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>

MS info on this can be found here:

http://msdn.microsoft.com/en-us/library/ms733025.aspx

Then use the trace tool to look at the results:

http://msdn.microsoft.com/en-us/library/ms732023.aspx

ISSUE 2:

I was running Windows Server 2008 64bit but the data source from Oracle for odata only appears to be available in 32bit and that is what I installed. I was getting an error 500. To fix this you need to set your App Pool to support 32bit executables. To enable this in IIS right click your app pool and under “Advanced Settings” set Enable 32-Big Applications to True. This fixed my error 500.

ISSUE 3:

I was calling my WCF Data Service and getting a NotSupportedException with an InnerException of “An error occured while processing this request” there was no other information provided. I had no idea why this was happening, I needed to know more! After a lot of searching the net I found this setting:

public static void InitializeService(DataServiceConfiguration config)
{
config.UseVerboseErrors = true;
}

Building and deploying with this enabled gave me a nice error with the inner exception exposed.

ISSUE 4;

ORA-12154: TNS:could not resolve the connect identifier specified

This doesn’t seem like much, and there are HEAPS of articles where it pops up but nothing I could find told me how to fix it. Until I came across this:
ORA-12154: TNS:could not resolve the connect identifier specified

It basically says copy your data connection configurations to your client folder. When I installed the VS Compoents and the Odata/Asp.net client it created a new home directory and the configurations files were not getting picked up from the server home. I copied these and everything started to work!
NOTE: I needed to restart Oracle and IIS for these new settings to take effect.