Dryadwoods Dryadwoods - 1 year ago 120
C# Question

MVC Global.asax --> ServiceRoute / WebServiceHostFactory class does not exist

Inside the global.asax of my MVC website I am trying to add a reference for a WCF Service, according to what I found online, I should use something similar to:


routes.Add(new ServiceRoute("Person", new WebServiceHostFactory(), typeof(PersonService)));

"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults

But, even after saying that the class
is using the namespace System.ServiceModel.Activation, the compiler still says that is not an existing class.....

The same happens to the class "
"... visual studio ask me if I want to create this class......

What am I missing in here?

tom tom
Answer Source


 routes.Add(new ServiceRoute("Person", new ServiceHostFactory(), typeof(namespace.PersonService)));

Detailed reason is found in this Answer.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download