开发者

wcf service hosted under IIS address

I have a WCF service hosted under IIS. I have the following configuration:

<services>
      <service name="BillboardServices.LoginService" behaviorConfiguration="LoginServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://myip/LoginService/" />
          </baseAddresses>
        </host>
        <endpoint address="" name="LoginService" binding="basicHttpBinding" contract="BillboardServices.ILoginService" />
          <endpoint contract="IMetadataExchange" 开发者_JAVA技巧binding="mexHttpBinding" address="mex" />
      </service>

If I enter http://myip/LoginService/, I get a 404. If I enter http://myip/Service1.svc, I get the service metadata.

What changes to the configuration do I need in order for the service to be accessible through the nice url?

Thank you.


In order to have and extensionless service, you need to use WCF 4 and init the routing engine in the global.asax file like so:

void Application_Start(object sender, EventArgs e)
    {
        RegisterRoutes();
    }

    private void RegisterRoutes()
    {
        // Edit the base address of Service1 by replacing the "Service1" string below
        RouteTable.Routes.Add(new ServiceRoute("Service1", new WebServiceHostFactory(), typeof(Service1)));
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜