简体   繁体   中英

AvailableVirtualMemory on IIS and Console application

I'm having problems to get the real value of AvailableVirtualMemory in IIS and a Console application, as detailed below:

When i run these commands on a Console application:

Console.WriteLine(String.Format("Memoria virtual total: {0}MB", My.Computer.Info.TotalVirtualMemory / 1024 / 1024))
Console.WriteLine(String.Format("Memoria virtual disponible: {0}MB", CDec(My.Computer.Info.AvailableVirtualMemory / 1024 / 1024)))

The Console shows me these results:

Memoria virtual total: 8388607.875MB
Memoria virtual disponible: 8388028.16015625MB

But when I run these commands on a .aspx page:

Response.Write(String.Format("Memoria virtual total: {0}MB", My.Computer.Info.TotalVirtualMemory / 1024 / 1024))
Response.Write("<br>")
Response.Write(String.Format("Memoria virtual disponible: {0}MB", CDec(My.Computer.Info.AvailableVirtualMemory / 1024 / 1024)))

The page shows me these results:

Memoria virtual total: 4095.875MB
Memoria virtual disponible: 3367.91796875MB

Why exists this difference on these different applications? I'm using a 64 bits operating system. I've searched for reasons in Google and here but I didn't found anything...
Thanks in advance.

The application pool (and yes IIS Express even has these) for the site that your .aspx page is running in is probably configured for 32 bit mode which is why it's returning 4GB and 3.3GB respectively. Being a 32 bit process that's all it can see.

If you're running this page in the Visual Studio toy web server you'll get the same result because it's 32 bit only as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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