Http status code for a WCF service

Discussion in 'General troubleshooting' started by Timmay, Apr 12, 2010.

  1. Hello,

    I've created an application start point and uploaded a WCF service to the corresponding folder (http://errorsnitch.com/wcf/ErrorSnitchService.svc). Then modified web.config to handle multiple bindings.

    The service worked for a while, but has being restarted several times (the DB was cleared, because I use ActiveRecord and it regenerates tables on evey application start).

    But then the service stopped working as expected, it throws HTTP status code 400.

    Is there any way to see IIS logs to understand what's wrong with it?
    Also, I log every event in Global.asax to file, and only Application Start gets logged, even the second LogMessage call from the same even doesn't work.

    Thank you.
    Tim
     
  2. Ray

    Ray

    I'm afraid the IIS/Server logs will not record this. Not in a shared hosting environment. What is or was the error message you are getting?
     
  3. Ray

    Ray

    Check your applications web.config file and make sure you have all the necessary elements to let your web service run correctly. The error "XML Parsing Error" can mean a lot of things but typically the first source is the applications web.config file.
     
  4. I can run it locally with no problem.

    The trust level if set to Full, added multiple HTTP bindings and the connecting string is specified for hosting.

    Are there any hosting-specific sections I should check?
     
  5. Ray

    Ray

    No, not really. Try uploading the application configuration file once more. It could be that your web.config may have gotten corrupted during upload.
     
  6. Nope, still the same.

    I use CastleProject ActiveRecord, HNibernate and log4net libraries, if it can help.

    The worst thing is that I don't even know where to digg.

    All the project libraries use .NET 3.5 and x86 architecture.
     
  7. Ray

    Ray

    Do you have any other xml file your application tries to connect to?

    What is the URL so we can see this error message?
     
  8. Hi Ray,

    Sorry didn't answer yesterday.

    There are total of 3 XML files on the site: web.config in the root (for the web-site itself. However, I was testing the service without the site and this web.config), web.config for the service under /wcf folder (which is an application start point) and crossdomain.xml under /wcf.

    The URL is http://www.errorsnitch.com/wcf/ErrorSnitchService.svc

    From time to time my simple logger (just a plain txt file in the root) shows that a request reached the service and the authorization was required. That makes me think it can be something with authorization. I use <authentication mode="None"/> in the web.config. Is that correct?

    Thanks,
    Tim
     
  9. Ray

    Ray

    So where exactly are you seeing the error message...

    XML Parsing Error: no element found

    Are you looking at your logger when you see this error message?

    I don't think it is an authorization issue. I have never seen this error due to some authorization issue. The error message is pretty much associated to some kind of xml file passing a malform value.
     
  10. No, I don't think so.

    My bad, I didn't specify that I get this error under FireFox. It expects text/html content to be sent by the server, but gets a blank response with status code 400: Bad Request. It's basically FF's DOM model parser.

    I coded it in Visual Studio 2010, but the target platform is set to .NET 3.5 everywhere, so I think it's not the reason. Unless VS writes something to the output DLLs. An attribute or so.
     
  11. Hi Ray,

    Yesterday I was trying to find the problem, rectreated solution, changed service bindings, reuploaded several times, restarted the app pool... No luck.

    But today for some reason it works fine.

    I will test it for several days and will let you know it there are any issues.
    Unfortunately, I can't provide the solution as I don't know it.

    Anyway, thank you for your help.
    Have a great day.

    Tim
     
  12. This is weird, but I noticed that http://www.errorsnitch.com/wcf/ErrorSnitchService.svc responds status code 400 if I hit it with a desktop browser. When I try to open it from an iPhone, it shows standard WCF welcome screen with no errors.

    That's strange, but I don't really know where to investigate it.
    Did I understand correctly there is no logging for shared hosting? Can I use remote debugging?

    Thanks,
    Tim
     
  13. Ray

    Ray

    Try checking your browsers security settings and try using different browsers.
     
  14. Hi Ray,

    It turned out it didn't work only if there was "www." in front of the address.
    If I remove it - everything's fine.

    I don't think it's critical as soon as it works.

    Thanks,
    Tim
     
  15. Glad you got it working.
     

Share This Page