.NET 3.5 中的 REST 友好 WCF 端点

发布于 2024-08-14 07:16:46 字数 182 浏览 1 评论 0 原文

我想通过避免使用 .svc 来使用我的 WCF 服务端点创建 REST 友好的 URL。我知道我可以通过使用 IIS 重写模块附加 .svc 来完成此任务。

还有其他人知道更好的方法吗?

请注意,我仅限于.NET 3.5,无法使用.NET 4.0(因此无法在.NET 4.0中使用System.Web.Routing)

I wanted to create REST friendly URLs with my WCF service endpoints by avoiding the use of .svc. I know I can accomplish this by using IIS rewrite module to append the .svc.

Does anyone else know of a better way to do this?

Please note that I am limited to .NET 3.5 and cannot use .NET 4.0 (so can’t use System.Web.Routing in .NET 4.0)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

月竹挽风 2024-08-21 07:16:47

不再支持 WCF REST 入门工具包,建议的升级路径使用 ASP.Net Web API,该 API 是 ASP.Net MVC 4.0 的一部分,可以在 此处

不幸的是,如果不使用重写模块,目前还没有办法做到这一点。 MS 的一个团队正在开发 WCF REST 入门工具包,可在此处 谁在考虑实现此功能。

在我今年早些时候就该主题进行的 Microsoft DevDays 演示中,Ron Jacobs 确认只有 Framework 4.0 及以上版本才提供执行此操作的功能,并且对于重写模块以下的任何内容来说,这是执行此操作的唯一方法。

The WCF REST Starter Kit is no longer support and the suggested upgrade path uses the ASP.Net Web API which is part of ASP.Net MVC 4.0 and can be found here

Unfortunately without using the Rewrite module therre is currently no way of doing this. There is a team at MS working on the WCF REST Starter Kit available here who where looking at implementing this functionality.

During a Microsoft DevDays presentation I did earlier this year on the topic, a got confirmation from Ron Jacobs that the ability to do this will only be available in Framework 4.0 onwards, and for anything below the rewrite module is the only way to do this.

痕至 2024-08-21 07:16:47

您可以将 ISAPI 重写模块“插入”到 IIS 中来为您执行此操作,例如 Ionic:

http:// /www.codeplex.com/IIRF

您还可以早在 .NET 1.1 中编写自己的 HTTP 重写引擎 - 尽管这需要有一个可以映射为使用 ASP.NET 引擎的文件扩展名仅在 IIS 将请求传递到 .NET 后重写 - 但它可以是您选择的任何扩展名。

对于你的问题,ISAPI重写模块是最好的解决方案。

You can "plug in" an ISAPI rewrite module to IIS that would do this for you, such as Ionic:

http://www.codeplex.com/IIRF

You can also write your own HTTP rewrite engine as early as .NET 1.1 - although that would need to have a file extension that could be mapped to use the ASP.NET engine as it only rewrites after IIS passes the request to .NET - but it could be any extension you choose.

For your question, the ISAPI rewrite module is the best solution.

∝单色的世界 2024-08-21 07:16:47

WCF Contrib 库(我还没有使用过)声称有能力做到这一点。

The WCF Contrib library (which I have not used yet) claims to have the ability to do this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文