WCF Rest Service Problem

Discussion in 'Site Programming, Development and Design' started by thehandygeek, Apr 7, 2010.

  1. Hi:

    I am in the process of creating and hosting a WCF REST web service. I'm using the Microsoft WCF REST Starter Kit Preview 2 to build the service. The kit includes some Visual Studio templates to get you started. To try it out I have created a project using the HTTP Plain XML WCF Service. This template creates some functioning stub code to test with. I can get it working with my local IIS server but when I try to publish it to my Winhost account it fails with the following error:

    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0234: The type or namespace name 'ServiceModel' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

    Source Error:

    Line 4: using System.ServiceModel;
    Line 5: using System.ServiceModel.Activation;
    Line 6: using Microsoft.ServiceModel.Web; <-- error here. Can't find assembly.
    Line 7:
    Line 8: namespace RestService

    The Microsoft.ServiceModel.Web is part of the WCF REST Starter Kit. I have checked and the correct dll is copied to the application bin directory along with service dll. Not sure why it can't find it. I have also tried adding a reference to the assembly in the web.config file but that didn't work either. Any ideas?

    Thanks
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    Do you have a link we can use to see this error message?
     
  3. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  4. Thanks for the quick response. That fixed the error however I am now getting an exception which I will have to investigate further. Its coming from WebServiceHost2 constructor.
     
  5. Ray

    Ray

  6. Thanks Ray.

    The first link you gave me had a way to define a base address prefix filter which got around the last problem. I noticed that the IIS is setup for three ways to address the site.
    domain.com
    www.domain.com
    userID.w01.Winhost.com
    This was causing the problem. Is there a way to setup IIS to only have one like it is for my local IIS install? From what I have read this is a design issue with WCF.

    Also, my service still isn't working. I had an authentication issue which was easy to fix but now I get an internal server error. You can check using the link I gave you earlier.

    I am somewhat baffled at to why I having so many issues with just a basic webservice. I haven't even got to the point of calling any of the functions or even trying to access a SQL database which I hope to do at some point.
     
    Last edited by a moderator: Oct 14, 2015
  7. Ray

    Ray

    I do not recommend altering the header names to your account. You are on a shared IP and the header names are the primary method on how IIS will redirect calls to your root.
     
  8. I'm assuming people have WCF based web services working in Winhost. I've tried both SOAP and REST based WCF services from templates in Visual Studio 2008 and can't get any of them to work. They work fine on my local IIS server. I'm assuming it is some sort of configuration detail. Does anyone have some sample code that works on Winhost? I don't care what type of service it is as long as it works. All I need is a working starting point which I can modify for my own needs.

    Thanks.
     
    Last edited by a moderator: Oct 14, 2015
  9. I'm sorry, it appears as though I was fighting competing web.config files. I would publish my files through Visual Studio and I would make changes to the web.config file using IIS Manager. When I would republish, the changes would get lost or I would end up with an invalid web.config file. All is working now. There's a moral there somewhere :) It appears as though I will need to keep two copies of the file, one for local testing and one for publishing.

    Thanks.
     
  10. Glad you got it worked out!
     

Share This Page