404 at all endpoints

1,953 views
Skip to first unread message

nikitamk

unread,
Jan 27, 2011, 9:15:12 AM1/27/11
to ServiceStack .NET Open Source REST Web Services Framework
Hello!

I'm trying to run ServiceStack.Hello application on Ubuntu 10.10 /
Apache2 / mod_mono. I can access /servicestack/metadata page, but all
endpoints (i.e. servicestack/xml/metadata?op=Hello) return 404 error
(ASP.NET error page). I also tried Nginx / FastCGI setup - same
problem. Application works well with XSP server on Ubuntu and VS
Development Server in WindowsXP. Is it something I'm missing?

Demis Bellot

unread,
Jan 27, 2011, 9:28:46 AM1/27/11
to servic...@googlegroups.com
Hi Nikita,

Is it just the metadata pages that don't work? or even the web services themselves?

What handler mapping do you have in your Web.config? 


nikitamk

unread,
Jan 27, 2011, 9:34:27 AM1/27/11
to ServiceStack .NET Open Source REST Web Services Framework
Here is a test setup: http://46.137.124.55/bss/servicestack/metadata

In Web.config I have:

In <httpHandlers>:

<add path="ServiceStack*,ServiceStack*/*,ServiceStack*/*/
*,ServiceStack*/*/*/*"
type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,
ServiceStack" verb="*"/>

In <handlers>:

<!-- ServiceStack: Handler mapping for IIS 7+ -->
<add name="ServiceStack.Factory" path="ServiceStack"
type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,
ServiceStack" verb="*" preCondition="integratedMode"
resourceType="Unspecified" allowPathInfo="true"/>

It's compiled project from Examples with no changes at all.

On 27 янв, 17:28, Demis Bellot <demis.bel...@gmail.com> wrote:
> Hi Nikita,
>
> Is it just the metadata pages that don't work? or even the web services
> themselves?
>
> What handler mapping do you have in your Web.config?
>

Demis Bellot

unread,
Jan 27, 2011, 9:41:42 AM1/27/11
to servic...@googlegroups.com
Ok mono actually only looks at the first (i.e. IIS 6 mapping).

Actually now I know where everyone is getting the old config path from (I haven't actually changed it in Examples project in GitHub - I will do this tonight :)

So can you give this a try?

<system.web> <httpHandlers> <add path="servicestack*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> </httpHandlers> </system.web>


Note: I'm collating a list of supported mappings which I'll be maintaining here:

I'll need to keep a list of which server configurations go with which mappings. 
If the above doesn't work, let me know if any of the supported ones will.

Cheers,

nikitamk

unread,
Jan 27, 2011, 9:51:14 AM1/27/11
to ServiceStack .NET Open Source REST Web Services Framework
This mapping works:

public const string CatchAllWildcard = "*";

And with this mappings even "/servicestack/metadata" page don't work:

public const string ServiceStack = "servicestack";
public const string ServiceStackWildcard = "servicestack*";
public const string ServiceStackAshxForIis6 = "servicestack.ashx";

Thanks for help! :)

On 27 янв, 17:41, Demis Bellot <demis.bel...@gmail.com> wrote:
> Ok mono actually only looks at the first (i.e. IIS 6 mapping).
>
> Actually now I know where everyone is getting the old config path from (I
> haven't actually changed it in Examples project in GitHub - I will do this
> tonight :)
>
> So can you give this a try?
>
> <system.web> <httpHandlers> <add path="servicestack*"
> type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,
> ServiceStack" verb="*"/> </httpHandlers> </system.web>
>
> Note: I'm collating a list of supported mappings which I'll be maintaining
> here:https://github.com/mythz/ServiceStack/blob/master/src/ServiceStack.We...

Demis Bellot

unread,
Jan 27, 2011, 10:11:27 AM1/27/11
to servic...@googlegroups.com
You're welcome :)

I think I have to collate a list of supported configurations for different environments, with this included!

Cheers,

ruionwriting

unread,
Nov 17, 2011, 5:49:55 PM11/17/11
to servic...@googlegroups.com
Demis, the link to the list of supported mapping is broken. Can you supply a new one?

I'm having this 404 problem deploying on nginx server with mono 2.10.5.

Demis Bellot

unread,
Nov 17, 2011, 5:57:38 PM11/17/11
to servic...@googlegroups.com
Hmmm, I can't actually find it - it appears to be victim in between migrating ServiceStack to an organization and nuking the old repo to point to the new org one.

Basically the only supported mappings are at root i.e. / and at a custom path i.e. /api 
The ServiceStack.Hello example project provides examples of these mappings at:

Also the StarterTemplates project is basically a collection of "blank ServiceStack projects" hosted on every supported configuration:

Hope this helps,

Cheers,


On Thu, Nov 17, 2011 at 5:49 PM, ruionwriting <r...@ruionwriting.net> wrote:
Demis, the link to the list of supported mapping is broken. Can you supply a new one?

I'm having this 404 problem deploying on nginx server with mono 2.10.5.



ruionwriting

unread,
Nov 17, 2011, 6:11:33 PM11/17/11
to servic...@googlegroups.com
I'm testing using CustomPath40 sample with the documented changes on Web.Config. 
I've deployed it to a test website on nginx (using fastcgi_mono_server4) and all calls to /api/something return 404.

Help!

ruionwriting

unread,
Nov 17, 2011, 6:27:15 PM11/17/11
to servic...@googlegroups.com
This sample, by you is returning also 404?

Demis Bellot

unread,
Nov 17, 2011, 6:42:29 PM11/17/11
to servic...@googlegroups.com
Case sensitivity on unix :)

Correct url:


On Thu, Nov 17, 2011 at 6:27 PM, ruionwriting <r...@ruionwriting.net> wrote:
This sample, by you is returning also 404?



Demis Bellot

unread,
Nov 17, 2011, 7:41:03 PM11/17/11
to servic...@googlegroups.com
This actually sounds like a very uncool bug that likely still exists in mono's ASP.NET handler mapping.

I actually reported this in detail a while ago, so I'm guessing it still hasn't been fixed.

Basically the crux of the problem is that you need to have the virtual directory on which your web application is hosted to contain the text of your custom path otherwise you get the erroneous behavior below:

1) The major bug that occurs in all MONO ASP.NET hosts using a custom handler (e.g. /api) is that if the virtual host / application path (i.e. /CustomPath/api ) does not start with the same name as registered <httpHandler /><add path="api*"/> then for some strange reason (i.e. as these 2 configurations shouldn't be related), it fails to pass nested paths more than 1 level deep, e.g: 
http://servicestack.net/CustomPath40/api/hello - works
http://servicestack.net/CustomPath40/api/hello/world - does not work
http://servicestack.net/CustomPath40/api/hello/world/1/2/3 - neither does any nested part from here on in
 
By contrast if the virtual path started with the same name e.g. /ApiPath35 and a <httpHandler/> of 'api*' then all requests below work as expected:
http://www.servicestack.net/ApiPath35/api/hello
http://www.servicestack.net/ApiPath35/api/hello/world
http://www.servicestack.net/ApiPath35/api/hello/world/1/2/3

Hope this helps.

Cheers, 

ruionwriting

unread,
Nov 18, 2011, 5:39:37 AM11/18/11
to servic...@googlegroups.com
Hi Demis,

All are returning an 500 (AppHostBase.Instance has already been set). Should be something temporary. 

The way the requests are interpreted at path level is a major issue and I know is a question of understanding and achieve proper settings.

Can you share your nginx configuration file for me to compare with my one?

mythz

unread,
Nov 18, 2011, 6:28:39 PM11/18/11
to servic...@googlegroups.com
Sure, I've attached my nginx.conf and mono_fastcgi config files needed to run www.servicestack.net

It looks like the AppHost is being restarted too many times, I would check to ensure there are were no exceptions when first starting the apphost.
Also the last time this happened was a result of an IOC auto creating instances of AppHost which is solveable if you make your AppHost internal.

Let me know if you need the apache configs as well.

Cheers,
Demis
etc.zip

ruionwriting

unread,
Nov 19, 2011, 5:15:43 PM11/19/11
to servic...@googlegroups.com
Thanks Demis, I'll back to this as soon I finish the setup for my new backup server :P.

ruionwriting

unread,
Nov 22, 2011, 9:24:52 PM11/22/11
to servic...@googlegroups.com
Solved after reviewing you files. Location for api/ (missing) was the issue.

Also I liked the way your script loads asp.net web apps. I've to implement something similar on my server.

Tkx, again.

Demis Bellot

unread,
Nov 22, 2011, 9:42:08 PM11/22/11
to servic...@googlegroups.com
kool, glad to hear it's sorted!

Always happy to see another happy Mono + ServiceStack user :)

D
Reply all
Reply to author
Forward
0 new messages