locked
WCF Data Service returns 404 error in IIS 7 RRS feed

  • Question

  • Hi,

    I'd like to host WCF Data Services as part of an ASP.NET MVC 2 / .NET 3.5 project in IIS 7. The data service works fine when using Visual Studio's own webserver (Cassini), but when hosting the web service in IIS 7, I only get a 404 error.

    Here's a screenshot of the browser: http://screencast.com/t/NDg2OWU3

    I thought it might be a problem with the svc handler mappings, so I followed the instructions at http://msdn.microsoft.com/en-us/library/ms752241%28VS.85%29.aspx. There were actually already some svc handlers for .NET 4 in place. I replaced them with .NET 2 / 3 handlers as described on that webpage just to make sure, but that did not seem to have any effect.

    Now I don't know what to try next. Please help!

    Thanks,

    Adrian

     

     

    Thursday, June 3, 2010 10:40 AM

Answers

  • Thanks for your follow-up. The problem was that I had not copied my connection string from the data layer assembly to the web service project. For some unknown reason, IIS gave me a 404 error insteadof returning a proper error message. It's all sorted out now though.

     

     

    Monday, June 14, 2010 9:33 AM

All replies

  • Hi,

    404 usually means the resource is not there - in your case the .svc file is either in a different place or it's hidden by IIS.

    Few things I would try:

    - Check that you're really running IIS on the port your address points to. Default installation of IIS should respond with a "picture" page to the very root of the URL (so http://localhost:portnumber).

    - Did you try the default port 80 - by default IIS installs itself to the port 80 (so http://localhost)

    - Put some image file (jpg, whatever) right next to your .svc file and try to navigate to it through the browser. If you don't even get the picture, then there's something wrong with your IIS configuration.

    - If you think that you're actually are hitting the service correctly, then you can try attaching a debugger to it and see why it fails (should throw exception).

    Thanks,


    Vitek Karas [MSFT]
    Friday, June 4, 2010 8:43 AM
    Moderator
  • Hi Adrian,

     

    I am writing to check the status of the issue on your side.  Would you mind letting us know how is the problem now? 

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, June 10, 2010 2:04 AM
    Moderator
  • Thanks for your follow-up. The problem was that I had not copied my connection string from the data layer assembly to the web service project. For some unknown reason, IIS gave me a 404 error insteadof returning a proper error message. It's all sorted out now though.

     

     

    Monday, June 14, 2010 9:33 AM
  • Im hosting a data service inside a MVC3 project an i had a similar problem, but  resolved it by adding 

     " routes.IgnoreRoute("{resource}.svc/{*pathInfo}"); "

    to the Global.asax file.

     

    hope it can help other users

    Tuesday, March 15, 2011 1:34 AM
  • Thank you very much for sharing the solution, RicBat!

    Have a nice day!

    Thanks


    Michael Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Tuesday, March 15, 2011 1:35 AM
    Moderator