很多时候,当我通过断开远程网络来更改VPN状态时,我的VS实例会立即崩溃.
这是我在事件日志中找到的最接近的东西.有人对此有什么想法吗?
Exception: System.Net.NetworkInformation.NetworkInformationException
Message: Invalid access to memory location
StackTrace: at System.Net.NetworkInformation.SystemNetworkInterface.GetAdaptersAddresses(AddressFamily family, FixedInfo fixedInfo)
at System.Net.NetworkInformation.SystemNetworkInterface.PostWin2KGetNetworkInterfaces(AddressFamily family)
at System.Net.NetworkInformation.SystemNetworkInterface.GetNetworkInterfaces(AddressFamily family)
at System.Net.NetworkInformation.SystemNetworkInterface.InternalGetIsNetworkAvailable()
at System.Net.NetworkInformation.NetworkChange.AvailabilityChangeListener.ChangedAddress(Object sender, EventArgs eventArgs)
at System.Net.NetworkInformation.NetworkChange.AddressChangeListener.AddressChangedCallback(Object stateObject, Boolean signaled)
at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(Object state, Boolean timedOut)
奇怪的问题在这里。在 asp.net webforms (4.5 / 4.7) 的本地开发中,我发现即使正确设置 httpruntime.Cache 始终为空。我在另一个 iis express 工作站上尝试了它,发现了相同的行为,即使是测试单页网页。生产 IIS 7.5 中的同一页面工作并且从缓存存储和传送。具体代码如下,但我尝试了一个测试器在 httpruntime.Cache 中存储一个简单的字符串。
var cache = System.Runtime.Caching.MemoryCache.Default;
var luCacheKey = "lu_" + dsName;
var ic = HttpRuntime.Cache.Get(luCacheKey) as ICollection;
if (ic == null) {
Run Code Online (Sandbox Code Playgroud)
和测试人员
var item = HttpRuntime.Cache.Get("x");
if (item == null)
{
HttpContext.Current.Cache.Insert("x", "test" , null, DateTime.Now.AddHours(1), Cache.NoSlidingExpiration);
Response.Write("added to cache<br>");
}
else {
Response.Write("already in cache");
}
Run Code Online (Sandbox Code Playgroud)
所以,我想知道 web.config 中是否有我可以查看的内容,或者这是预期的 IIS 表达行为?请注意, System.runtime.Caching 确实可以正常工作。
var cache = System.Runtime.Caching.MemoryCache.Default;
var ic = cache[luCacheKey] as …Run Code Online (Sandbox Code Playgroud)