在哪里可以找到有关 WCF Web API 的最新文档?

发布于 2024-12-17 13:34:40 字数 1174 浏览 0 评论 0原文

我一直在努力让 WCF 按照我希望的方式进行 REST。显然还有不少其他人也是如此。我听说过 WCF Web Api 项目,但错误地忽略了它看得太仔细了。可悲的是,现在我正在查看它,我发现该文档相当过时。例如,这篇博文有一些很好的信息,但是类已经改变,参数已经改变,简而言之,设计已经改变。

因此,我一直在使用一个如何插入 Json.NET (newtonsoft) 作为我的序列化器的旧示例,只是意识到在它工作后,它不适用于我的 IErrorHandler。此外,我对如何有疑​​问将 uri 模板中的字符串反序列化为操作类型参数

然而,看来我应该能够通过使用媒体格式化程序扩展点和所谓的处理器来解决这两个问题(大概还有我还没有遇到的许多其他问题)。 code> 在过时的文档中,现在是 HttpOperationHandler<..> 除非我误解了。

我的问题相当基本,假设我已经正确实现了它,我无法弄清楚如何正确配置 IIS 托管的应用程序以使用我的操作处理程序。由于就这样一个基本的事情寻求指示感觉相当愚蠢,所以我宁愿问在哪里可以找到一些关于如何做这类事情的文档? (当然欢迎解释。)

我不是在查看存在哪些类,或者它们的方法用什么参数命名。我可以在我的对象浏览器中看到所有这些。我需要整体设计的文档和/或隐式描述诸如以下内容的示例:

  • API 中的不同类如何组合在一起?
  • 如何从 web.config 进行配置?
  • 我必须做一个自定义的 HttpServiceHostFactory 吗?
  • 您打算使用该框架做什么以及如何使用?
  • 我应该如何扩展以达到什么样的目标?
  • 我应该如何配置才能使扩展生效?

I've been strugling with WCF to do REST the way I want it to work. And apparently so has quite a few others. I've heard about the WCF Web Api project, but wrongly dismissed it without looking too closely at it. Sadly, now that I'm looking at it I find that the documentation is rather outdated. Like, this blog post has some nice information, but classes have changed, parameters have changed, in short, design has changed.

So I've been using an old example of how to plug in Json.NET (newtonsoft) as my serializier, only to realize that after I had it working, it wouldn't work for my IErrorHandler. Further I had a problem with how to Deserialize a string from the uri template to an operation Type parameter.

It appears however that I should be able to solve these two problems (and presumably many others that I haven't stumbled over yet) by using the media formatter extension point and what's referred to as Processor<..>s in outdated documentation, which is now HttpOperationHandler<..>s unless I've missunderstood.

My problem is rather basic, I can't figure out how to correctly configure my IIS-hosted app to use my operation handler, assuming I've implemented it correctly. Since it feels rather dumb to ask for instructions on such a basic thing, I'll rather ask where I can find some documentation on how to do this sort of thing? (Explanations are welcome of course.)

I'm not after seing which classes exist, or what their methods are named with what parameters. I can see all that in my object browser. I need documentation for the overall design, and/or examples implicitly describing things like:

  • How do the different classes in the API fit together?
  • How can I configure from web.config?
  • Must I rather do a custom HttpServiceHostFactory?
  • What and how are you meant to use the framework?
  • How should I extend to reach what sort of goals?
  • How should I configure to place the extensions in effect?

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

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

发布评论

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

评论(1

南渊 2024-12-24 13:34:40

由于缺乏答案,我认为文档还没有准备好。

我在 codeplex 网站的 文档 选项卡下查找它,并发现了过时的内容。

然而,在熟悉了 Codeplex 之后,我发现好东西就在 这个讨论部分。老实说,在那里进行一些搜索很有帮助。

关于配置文件配置,我没有找到任何内容,所以我假设这将作为正式发布之前的最后一件事添加。这意味着我现在将在自定义 HttpServiceHostFactory 中使用 HttpConfiguration

关于 HttpOperationHandler 的技巧有两个:首先,我在操作中引发了异常,并且尚未实现全局 HttpErrorHandler 。 (哦!)其次,我不知道 HttpOperationHandler<..>.OnHandle 的参数名称必须与操作参数的名称匹配。

From the lack of answers I assume the documentation quite simply isn't ready.

I was looking for it on the codeplex site under the Documentation tab, and found outdated stuff.

However, after familiarizing myself a bit with Codeplex I found out that the good stuff was in this Discussion section. Searching a bit in there helped a lot to be honest.

Concerning config-file configuration, I didn't find anything, so I'm assuming this will be added as the last thing before official release. Meaning I'll use the HttpConfiguration in a custom HttpServiceHostFactory for now.

The trick about the HttpOperationHandlers was twofold: Firstly I was throwing an exception in my operation and hadn't implemented a global HttpErrorHandler yet. (Doh!) Secondly I didn't know that the parameter name of HttpOperationHandler<..>.OnHandle had to match the name of the operation parameter.

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