简体   繁体   English

如何设置IIS请求镜像到暂存环境?

[英]How to set up IIS request mirroring to staging environment?

I would like to have all HTTP requests made to my production environment be also automatically made against my testing environment. 我希望对生产环境发出的所有HTTP请求也可以根据测试环境自动发出。 Eg if anything makes a request to http://production.site.example.com/api/users/12345 then I want the same request to also be made against http://staging.site.example.com/api/users/12345 by some internal entity that sees the first request. 例如,如果有任何请求http://production.site.example.com/api/users/12345那么我希望对http://staging.site.example.com/api/users/12345也发出相同的请求http://staging.site.example.com/api/users/12345由看到第一个请求的某个内部实体提供。

Is there an easy way to set this up in IIS without having to create a custom module or similar? 是否有一种简单的方法可以在IIS中进行设置,而无需创建自定义模块或类似模块? If not, what is the best approach to take when creating such a module, so this does not cause any extra load on the production instance of my app? 如果不是,那么在创建这样的模块时最好的方法是什么,那么这不会对我的应用程序的生产实例造成任何额外的负担?

Not sure what specifically you're trying to achieve here but you might try with something simple such as implementing redirect in OnUnload event handler (I'm assuming you're using ASP.NET) that will redirect traffic to your test environment. 不确定您要在此处实现的目标是什么,但是您可以尝试一些简单的操作,例如在OnUnload事件处理程序中实现重定向(假设您正在使用ASP.NET),它将流量重定向到测试环境。

This way you get everything processed in your production environment and once that is completed you redirect request to test env. 这样,您就可以在生产环境中处理所有内容,一旦完成,就可以将请求重定向到测试环境。 Again, not sure what specifically you're trying to do but I'd first try something simple like this using different redirects. 同样,不确定您要具体执行什么操作,但是我首先会尝试使用不同的重定向进行类似这样的简单操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM