2

I have WCF service up and running but today I thought what if I remove .svc extension from realative address and access my service in this way? net.tcp://serveraddress/services/service I but as soon as I changed config files program did not start. this programs and service are developed using .NET 4.0 and WCF 4 ad service itself is hosted in IIS 7.5

it is possible to access services in this way while having them hosted in IIS?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Rati_Ge
  • 1,262
  • 2
  • 15
  • 37
  • Have you tried changing the default page for the application in IIS to point to the svc file, or are you trying to avoid that all together? – iMortalitySX Oct 04 '12 at 19:02
  • I did not try changing default page but i prefer to avoid that as default page is not good solution because that every service needs to have same file name and this is not possible. – Rati_Ge Oct 04 '12 at 19:05

2 Answers2

1

This could be an issue with a handler in IIS. I also use extensionless WCF services, and I modified my web.config file to make it work. Add this to your web.config to see if it will help:

<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
  <remove name="UrlRoutingModule" />
  <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>

<handlers> 
<remove name="svc-Integrated-4.0" />
<add name="svc-Integrated-4.0" path="*" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
      <add 
        name="UrlRoutingHandler" 
        preCondition="integratedMode" 
        verb="*" path="UrlRouting.axd" 
        type="System.Web.HttpForbiddenHandler, System.Web,  
          Version=2.0.0.0, Culture=neutral,  
          PublicKeyToken=b03f5f7f11d50a3a"/> 
    </handlers> 
</system.webServer>
Bill Sambrone
  • 4,334
  • 4
  • 48
  • 70
  • ' ' is that right way tu rewrite? why shoud i remove and add handlers? – Rati_Ge Oct 04 '12 at 19:20
  • I still ca not achieve desired result can someone explain how to configure that? – Rati_Ge Oct 04 '12 at 19:48
  • does anyone know to to do this? my problem here is that I am using net.tcp binding. if a refer to it in http request fro browser it works but not for net.tcp – Rati_Ge Oct 04 '12 at 21:24
1

I have hosted my WCF service without svc file. I am adding ServiceRoute to RouteTable in Application_Start method in Global.asax file.

protected void Application_Start(object sender, EventArgs e)
{
    RouteTable.Routes.Add(new ServiceRoute("AdminDataService", new WebServiceHostFactory(), typeof(AdminService)));
    RouteTable.Routes.Add(new ServiceRoute("AuthenticationService", new WebServiceHostFactory(), typeof(AuthenticationService)));
}
Tushar Kesare
  • 700
  • 8
  • 20