I understood the problem. First of all, I skipped part of the path to a function that registers my routes. After I installed this path, I was able to open my wsdl in my hosting environment. However, this ruined the default routing for my areas. Therefore, for those who have this problem in the future, here is my solution:
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.svc/{*pathInfo}"); routes.MapRoute( "CustomFunctions", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "CustomFunctions", action = "Index", id = UrlParameter.Optional }, // Parameter defaults new { controller = "^(?!CustomFunctions).*" } ); routes.Add(new ServiceRoute("CustomFunctions", new ServiceHostFactory(), typeof(CustomFunctions))); routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); // Had to do some special stuff here to get this to work using a default area and no controllers/view in the root routes.MapRoute( name: "Default", url: "{area}/{controller}/{action}/{id}", defaults: new { area = "", controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new string[] { "Viper.Areas.Home" } ).DataTokens.Add("area", "Home"); }
I indicated my own route primarily so that when I navigated to the specified URL, it will show my .svc file. I call this method from my ApplicationStart method in Global.asax.cs. I also had to create a separate controller and view my user-defined functions in my home area so that it could distinguish between my default route and my CustomFunctions settings and indicated what was in my route map as shown above. Therefore, when I go to localhost \ Viper, it will find the route specified in my default map, and when I go to localhost \ Viper \ CustomFunctions, it will find the route to my .svc file. IgnoreRoute basically does this, so you donβt have to put the file extension at the end of the URL when your page is called. Therefore, instead of CustomFunctions.svc, I specify only CustomFunctions. Make sure you add the System.ServiceModel.Activation assembly and use the instructions for your project in doing so.
Thank you all for your help. Hope this helps another bad lost soul.
source share