Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7052899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:26:21+00:00 2026-05-28T03:26:21+00:00

I have an ASP .Net MVC 3.0 web application hosted on IIS and I

  • 0

I have an ASP .Net MVC 3.0 web application hosted on IIS and I am using Castle Windsor version 3.0.

What I would like to do is register a WCF service using the webHttpBinding without any entries in the web.config or having a .svc file. Is this possible?

I tried this in my IWindsorInstaller implementation:

container.AddFacility<WcfFacility>(f => f.CloseTimeout = TimeSpan.Zero);

container.Register(
    Component
        .For<IMyService>()
        .ImplementedBy<MyService>()
        .AsWcfService(new DefaultServiceModel()
                          .AddBaseAddresses("http://localhost/WebApp/Services")
                          .AddEndpoints(WcfEndpoint
                                    .BoundTo(new WebHttpBinding())
                                    .At("MyService.serv"))
                          .Hosted()
                          .PublishMetadata()));

And I am ignoring anything that finishes serv like so in my RegisterRoutes method in global asax:

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

If I point a browser at http://localhost/WebApp/Services/MyService.serv I get a 404.

What am I doing wrong or am I trying to do something stupid (or not possible or both!)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:26:22+00:00Added an answer on May 28, 2026 at 3:26 am

    Thanks to Ladislav’s suggestion of using the ServiceRoute I have worked out how to do this, but I am not sure it is ideal, here is what I have done (in case Googlers find it and can improve it etc):

    Created an extension method on ComponentRegistration like so:

    public static ComponentRegistration<T> AddServiceRoute<T>(
        this ComponentRegistration<T> registration, 
        string routePrefix, 
        ServiceHostFactoryBase serviceHostFactory, 
        string routeName) where T : class
    {
        var route = new ServiceRoute("Services/" + routePrefix + ".svc",
                                     serviceHostFactory,
                                     registration
                                         .Implementation
                                         .GetInterfaces()
                                         .Single());
        RouteTable.Routes.Add(routeName, route);           
        return registration;
    }   
    

    What that does is adds a service route that places the service under the Services folder and tacks on a .svc extension (I will probably remove that). Note, I am assuming that the service implements only one interface, but in my case that is fine and I think is good practice anyway.

    I’m not sure this is the best place to have this extension method, or even if an extension method is actually needed at all – perhaps I should be doing it with a service host builder or something, I don’t know!

    Then in the MapRoute calls I made sure to add this to the constraints parameter as per the question MVC2 Routing with WCF ServiceRoute: Html.ActionLink rendering incorrect links!

    new { controller = @"^(?!Services).*" }
    

    This just makes anything that starts Services not get matched as a controller. I do not like this very much since I would have to add it to all of my routes – I would rather globally make the Services folder fall into the service resolver or something (I do not know enough about MVC it seems!).

    Finally in my windsor installer I register the service like so:

    container.AddFacility<WcfFacility>(
        f =>
            {
                f.Services.AspNetCompatibility = 
                    AspNetCompatibilityRequirementsMode.Allowed;
                f.CloseTimeout = TimeSpan.Zero;
            });
    
    container.Register(
        Component
            .For<IMyService>()
            .ImplementedBy<MyService>()
            .AsWcfService(new DefaultServiceModel()
                             .AddEndpoints(WcfEndpoint.BoundTo(new WebHttpBinding()))
                             .Hosted()
                             .PublishMetadata())
            .AddServiceRoute("MyService", new DefaultServiceHostFactory(), null));
    

    After that I can browse to the service and it is picked up and constructed fine!

    As I allude to though, it might not be the best way to do this, but it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC web application running in IIS as a subweb; let's
I have a basic 3 tier app Presentation/Web (ASP.NET MVC) Application Services (WCF, hosted
I have an ASP.NET MVC web application which is hosted by an external provider,
I have an ASP.Net MVC web application using forms authentication. I am using OpenID
I have an ASP.NET MVC 3 Web Application using Linq-to-SQL for my data access
I have an ASP.NET 4.0 MVC web application running on IIS 6.0 with a
I have a Asp.net MVC web application, containing mostly text. I want to put
Here's what I'm trying to do. I have an ASP.NET MVC web application, where
I have developed a MVC web application with ASP.NET MVC and im just wondering
I have created blank Asp.Net-MVC 3 web application and want to write my own

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.