我最近使用各种资源将MEF添加到MVC/WebAPI应用程序,包括这个答案如何将MEF与ASP.NET MVC 4和ASP.NET Web API集成.虽然这工作了一段时间,但我开始收到与连接数据库相关的间歇性错误,最常见的错误是:"System.InvalidOperationException:Timeout expired.在从池中获取连接之前经过了超时时间.这可能是之所以发生,是因为所有汇集的连接都在使用中,并且达到了最大池大小."
我意识到我正在泄漏连接,但不明白为什么.我的所有存储库都实现了IDisposable并在完成时处理了它们的连接.在我的配置方法中加入断点很快就会发现它们永远不会被击中.当我将代码基于链接到上面的示例时,我注意到没有任何清理,但是对MEF和MVC不熟悉我错误地认为清理是在MVC的/ MEF的依赖管道中的某个地方完成的.
我想知道其他人如何在MVC和WebAPI中使用MEF来解决每个请求的合理范围?
我已经在这里和那里找到了模糊的指导,它们都面向MVC或WebAPI.Mef.codeplex在这里有一个几乎完整的MVC中心解决方案:https://mef.codeplex.com/releases/view/79090 但它基于MVC的预览版本.我在这里找到了一个WebAPI解决方案:https://github.com/WebApiContrib/WebApiContrib.IoC.Mef.我现在正在推出自己的解决方案但是由于我不想重新发明轮子,我想我会问是否有人知道有一个已经滚动.
I would like the public IP address from an App Service deployed from an ARM Template like the simplified one below. I've seen examples of getting the public inbound IP address from an API Gateway, VNET of a VM, App Service Environment, etc., but I haven't found anything that indicates how to get it out of a simple App Service deployment. I find navigating the ARM API, and how that translates into a string into a JSON file, rather byzantine. …