WCF Service reference namespace cannot be found

Scott White picture Scott White · Jul 9, 2012 · Viewed 18.3k times · Source

I've got a local WCF service in my solution which I have referenced. However my controller class is not able to pick up the Service namespace? Traditionally I would use svcUtil to write a wrapper class but as this is internal I though I could simply add 'Service Reference', tap into the namespace then simple invoke my service (ie var service = new QServiceReference.MyClass();)

I'm unable to show pictures so here's the structure for my solution,

Solution  
-> Services Folder
    -> QService Folder
       QService Project  
-> Web Folder
    -> Zipporah.Queuing.Web (project)
       -> Services References
          -> QServiceReference
       -> Controllers Folder
          -> KioskProcessController

My class (KioskProcessController) is as follows:

using System.Web.Mvc;

using Zipporah.Queuing.Web.QServiceReference; (ITS THIS NAMESPACE REFERENCE THAT DOES NOT WORK)

namespace Zipporah.Queuing.Web.Controllers
{
    public class KioskProcessController : ZipController
    {
        public ActionResult Index()
        {
            return View();
        }

        public ViewResult Queue()
        {
            return View();
        }

        public ViewResult PreAppointment()
        {
            return View();
        }
    }
}

Sorry if that structure is not clear (as aforementioned i cannot post pictures)

Any clues or thoughts would be most appreciated?

Answer

VSS picture VSS · Jul 9, 2012

The namespace generated for your WCF Client might be different than the one you are using. In your Solution Explorer window, when you select your Service References folder, you can enable the Show All Files button and then navigate to file Reference.cs as shown in below screenshot:

enter image description here

Then, in Reference.cs file, you can find the actual generated namespace by the Add Service Reference dialog, which you can use in your other file with a using statement.