servicestack default web index page

Hi Guys,

So the project we started as of today I am taking care of web side of things. So may be with occasional posts on PHP I will be writing few posts on Javascript, Webservices and ServiceStack.

I am not going to explain what ServiceStack is. You are here because you already know about it. In this post I am going to show you how to set Index page after you setup your ServiceStack successfully.

By default when you browse you are shown metadata page. This is because you haven’t set the default redirect path to your default page (Web service). I would use Page because that falls in line with web terminology.

So generally you dont want users to see your metadata page if you’re planning to open your software to browsers.

Here is what I did

The main configuration is made in the app host Configure method. I believe you have access to that CS file. in your configure method add this line

So my Configure method looked like this

Advertisement

 

Because I am using markdown templates I will define a Index.md file which for me has nothing but “Hello world” in there. Make sure that Property “Copy to Output Directory” has value “Copy Always

Now lets check what my Index.cs file looks like

 

Nothing much just return whatever is in there in my Index.md file that will be parsed automatically. So now when I try to browse my webservice as HTML I see Hello World on my screen rather than metdata page that highlights what web services are available.

I have left some room for you to improve. My motive was to give you insight on what variable we need to set to change the default metadata page load to something else. In my next post I am going to explain how you can disable metadata altogether.

I hope that helps.

Cheers,

 

Advertisement

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Comments

  1. Awesome! Its truly awesome post, I have got muych clear idea regarding
    from this post.

Speak Your Mind

*

CommentLuv badge