用于服务器端 C# 代码的最轻量的 http 主机
我目前有一个原型 Web 服务连接到 IIS 下的单个 .aspx 页面。对服务器端逻辑的调用是通过 http mywebengine.aspx POST 接口进行的,该接口具有所有服务器功能的公共 Post 参数。 Web 服务不发送 html,而是在每次调用时传入和传出 JSON 数据结构。
Web 服务不提供任何静态内容。
对于这样一个简单的 Web 服务来说,IIS 似乎在架构上显得有些过分,而且通过 aspx 页面路由所有调用也感觉很笨拙。
我可以使用哪些替代 MS 解决方案?我应该公开单个 WCF 函数,还是使用 IHttpHandler 在 .aspx 页面处理引擎之上的更高级别挂钩到 IIS 调用处理堆栈,或者在低级别的代码中手动处理 http 通信?
Azure 托管兼容性是另一个要求。
I currently have a prototype web service hooked up to a single .aspx page under IIS. Calls to the server-side logic are made through an http mywebengine.aspx POST interface with common Post parameters for all server functions. No html is shipped from the web service, instead JSON data structures pass in and out on each call.
The web service does not serve any static content.
IIS seems like architectural overkill for such a simple web service and also routing all calls through an aspx page feels clumsy.
What alternative MS solutions are available to me? Should I expose a single WCF function, or hook into the IIS call handling stack at a higher level above the .aspx page processing engine with an IHttpHandler or instead handle http comms manually in code at a low level?
Azure hosting compatibility is another requirement.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会考虑 IHttpAsyncHandler。我碰巧刚刚写了一篇涵盖您具体情况的文章。只需准备好捕获所有错误,如果它是 AJAX 目标,请在客户端中构建一些重试逻辑。运行良好,但偶尔会在 10K RPS 时放弃请求。
I'd consider IHttpAsyncHandler. I happened to have just written one that covers your exact situation. Just be prepared to catch all errors and if it's an AJAX target, build some retry logic into the client. Works swell but drops an occasional request at 10K RPS.