Combine classic ASP.NET and ASP.NET MVC within one

2019-03-15 20:31发布

We currently have a classic ASP.NET web application which serves as our API. It basically has a bunch of ASMX Web Services, but these are really cumbersome to work with from JavaScript. What I want is to expose a set of RESTful endpoints, but doing this in classis ASP.NET is not what I really want to do.

I'm considering to combine both classic ASP.NET and ASP.NET MVC in one web app. Is this possible at all? If yes, what are the issues/problems I may encounter?

3条回答
劫难
2楼-- · 2019-03-15 21:02

The whole goal of routing is to break the one-to-one association between URLs and files in the server’s file system. However, the routing system still does check the file system to see if an incoming URL happens to match a file or disk, and if so, routing ignores the request (bypassing any route entries that the URL might also match) so that the file will be served directly.

So, to answer on a part of your question "is this possible at all": Yes, because routing system will recognize the .asmx file on the file system and it will process it in classic asp.net web services manner.

For the second question I'm not sure because I haven't been doing anything complex with web service inside of the asp.net mvc application.

查看更多
姐就是有狂的资本
3楼-- · 2019-03-15 21:10

An ASP.NET Webforms application can become ASP.NET MVC enabled by following some simple steps,its quite easy infact see this link if you want to go rest for mvc heres a article Rest for mvc by Phil Haack and Rest like nature of MVC heres a comparison Rest in asp net vs wcf

查看更多
爷的心禁止访问
4楼-- · 2019-03-15 21:12

Aha! It seems that this is very much possible. Here's a comprehensive article which describes what should be done.

查看更多
登录 后发表回答