The following WCF endpoint works just fine with the WCF test client:
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "listflaggedassets/{platform}?endpoint={endpoint}&pid={portalid}&processCode={processCode}&index={index}&limit={limit}")]
AssetList ListFlaggedAssets(short processCode, string platform, string endpoint = "null", string portalId = "null", int index = 0, int limit = 12);
However, when I attempt to navigate to the URL http://localhost/DigitalREST/XosAssets.svc/listflaggedassets/SEC?endpoint=superfan&pid=0&processCode=0&index=0&limit=20
I get a 400 bad request.
I can't seem to find any way to figure out WHY i'm getting a bad request, and attaching to IIS for debugging doesn't break on any exceptions.
How can I investigate the cause of a bad request?
You could enable tracing and use Service Trace Viewer
Drop this into your app.config (logging sources taken from this answer):
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true" >
<listeners>
<add name="xml"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml"/>
</listeners>
</source>
<source name="myUserTraceSource"
switchValue="Information, ActivityTracing">
<listeners>
<add name="xml"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="TraceLog.svclog" />
</sharedListeners>
</system.diagnostics>
Then, open the TraceLog.svclog in Service Trace Viewer. It may not tell you exactly what's going on, but it will provide details about the traffic and the exception itself.
You may also want to check the exceptions you have enabled in the debugger. In Visual Studio, go to Debug -> Exceptions
and check that you have the correct framework checked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With