locked
Query works in browser, not in code RRS feed

  • Question

  • Hello,

    A data service I'm using is giving me some trouble. For some reason the production server isn't working while my local development version is. I tried the following query in my browser:

    MercuriusDataService.svc/Items?$filter=ERPID eq '9789057673535'

    That returns a Feed page with one item on it, as expected. Now when I run the same thing in code:

    context.Items.Where(i => i.ERPID == "9789057673535").FirstOrDefault();

    It throws an "object reference not set to an instance of an object" error. And as said; when I run the same thing locally (with the same database behind it) it does work. What could be going on and how can I get a clue of whatever is going wrong?
    MCTS in Web Application Development in .NET 2.0
    Wednesday, September 9, 2009 1:52 PM

Answers

  • Found it myself...

    This morning I was playing around with SSL certificates on the server which hosts this server. I installed a second wildcard certificate on sites on the same IP address which apparently isn't possible. That caused a certificate warning which didn't popup in my browser because I have the same certificate installed locally. But the service calls failed on this problem, which I found out when I tried the same thing from another computer which didn't have the certificate.

    I corrected the certificate problem and everything magically started working again.


    Too bad the error messages aren't more helpful. It seems the 'object reference not set to an instance of an object' error is quite common when something is wrong with the connection, it would be great to have some more info on what's causing the problem.
    MCTS in Web Application Development in .NET 2.0
    Wednesday, September 9, 2009 3:09 PM