在 MVC 中提供 WCF 服务
我想知道是否可以通过 MVC 提供 WCF 服务。我看过一些关于此的帖子,因为它与 RESTful 服务相关,但我并不打算创建 RESTful 服务。
我也看到过这个主题涉及到从 MVC 提供 .svc 文件,但我也没有寻找这个。
基本上,我只是想通过 MVC 公开我的 WCF 服务,而不是带有 svc 文件的典型 Wep 应用程序类型结构。
因此,我不会使用 ttp://localhost/MyService.svc,而是只使用 ttp://localhost/MyService,然后将其发送到返回数据的控制器。
是否可以有一个“servicehost”控制器?我认为最大的障碍是 IIS 基于 .svc 扩展名以某种方式处理服务 - 是否必须为这样的事情设置某种自定义处理程序?
有什么想法吗?
I'm wondering if it's possible to service up WCF services via MVC. I've seen a few posts about this as it relates to RESTful services, but I'm not looking to create a RESTful service.
I've also seen this topic covered as far as serving up .svc files from MVC, but I'm not looking for that either.
Basically, I'm just looking to expose my WCF services via MVC, instead of a typical Wep App type structure with svc files.
so instead of having ttp://localhost/MyService.svc, I would just have ttp://localhost/MyService and that would go to a controller that would return the data.
Is it possible to have a "servicehost" controller? I would assume that the biggest obstacle to this would be that IIS handles the service a certain way based on the .svc extension - would some kind of custom handler have to be set up for something like this?
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在没有 MVC 的情况下执行此操作(或者,似乎也可以使用它)
http://geekswithblogs.net/michelotti/archive/2010/08/21/restful-wcf-services-with-no-svc-file-and -no-config.aspx
http://geekswithblogs.net/michelotti/archive/2010/09/22/wcf-rest-services-inside-mvc-projects.aspx
You can do this without MVC (or, it seems, with it too)
http://geekswithblogs.net/michelotti/archive/2010/08/21/restful-wcf-services-with-no-svc-file-and-no-config.aspx
http://geekswithblogs.net/michelotti/archive/2010/09/22/wcf-rest-services-inside-mvc-projects.aspx