liubiao4123 / servicestack

Automatically exported from code.google.com/p/servicestack
0 stars 0 forks source link

MVC + Hello World Tutorial #59

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Start a new MVC project (via MonoDevelop)
2. Go through the steps to integrate Service Stack following "Hello World" 
tutorial (use step 2b)
3. MVC route blocks ServiceStack route

What is the expected output? What do you see instead?
Expected that the service stack route would take over.

What version of the product are you using? On what operating system?
2.0.9 on mac osx tiger

Please provide any additional information below.
The fix seems to be adding an ignore to the MVC configuration.  In my specific 
example this turned out to be in the RegisterRoutes method (in Global.asax.cs):
            routes.IgnoreRoute ("servicestack/{*pathInfo}");

Original issue reported on code.google.com by claytonh...@gmail.com on 22 May 2011 at 2:13

GoogleCodeExporter commented 8 years ago
okie kool,

BTW this project is deprecated, please post future issues on the group / 
mailing list:
http://groups.google.com/group/servicestack

or GitHub Issues:
https://github.com/ServiceStack/ServiceStack/issues

Does changing the order of the handler mappings make any difference?
i.e. Can you please upload your web.config

Otherwise your IgnoreRoutes rule seems like a good workaround for this issue.

Original comment by demis.be...@gmail.com on 22 May 2011 at 2:21

GoogleCodeExporter commented 8 years ago
I haven't tried changing the order of the handler mappings.  I did try 
initializing the ServiceStack routings before the MVC routings but that had no 
effect.

Original comment by claytonh...@gmail.com on 22 May 2011 at 2:23

Attachments:

GoogleCodeExporter commented 8 years ago
Does it make a difference if you re-arrange the order like?

    <httpHandlers>
      <remove verb="*" path="*.asmx" />

<!-- Required for MONO Service Stack -->            
<add path="services*" 
type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, 
ServiceStack" verb="*"/>
<!-- Required for MONO Service Stack -->

      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
      <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

    </httpHandlers>

Original comment by demis.be...@gmail.com on 22 May 2011 at 2:34

GoogleCodeExporter commented 8 years ago
No that doesn't fix the issue.

Original comment by claytonh...@gmail.com on 22 May 2011 at 2:40

GoogleCodeExporter commented 8 years ago
ok no good, it looks like ASP.NET MVC is hijacking all the routes.

I can't really do much about it in ServiceStack since it doesn't know about 
ASP.NET MVC. I think the IgnoreRoutes option is the best workaround for the 
moment.

Original comment by demis.be...@gmail.com on 22 May 2011 at 2:46

GoogleCodeExporter commented 8 years ago
That's cool, I expected that was the case and I am fine with the work 
around...it took me a couple hours to figure it out thought so might be useful 
to update the tutorial.

Original comment by claytonh...@gmail.com on 22 May 2011 at 5:31

GoogleCodeExporter commented 8 years ago
Yep absolutely, I've just made a note on the Hello World page:
http://www.servicestack.net/ServiceStack.Hello/

Thanks for the tip!

Original comment by demis.be...@gmail.com on 22 May 2011 at 1:55

GoogleCodeExporter commented 8 years ago
Awesome, thanks!

Original comment by claytonh...@gmail.com on 22 May 2011 at 2:25