Recently I had a problem with explorer on Windows 7 – when coworker tried to open explorer when not on local network, “Server execution failed” error happened. I was suspecting that the problem might be connected to mapped disks which were not accessible, when not on local network, but wasn’t sure how this could lead to such an obscure error. After some heavy duty browsing I found a solution: the problem was in “Launch folder windows in a separate process” setting. This setting can be found somewhere in Folder Options window and it should be unchecked on Windows 7. By default this setting is not checked, because it can eat more RAM and can slow down your computer. But it also says that it could increase Windows stability (when error in one process occurs other processes are not affected). But obviously there is a bug in Windows 7, because everything stops working when not in domain. 🙂 In Windows 8.1 I didn’t detect this problem. Well, problem solved – yipikaye motherf****r. 🙂
Category Archives: Administration & Configuration
Computer and server administration and configuration.
VirtualBox is missing x64 version of guest OSs
I was migrating x64 Ubuntu VM from one VirtualBox to another (on different computer). The procedure is as simple as it can be: you copy files from one machine to another and than add new machine. When you are asked to configure hard disk, you choose “Use an existing virtual hard disk file” and set the location to those files and that’s pretty everything you have to do. But I had a problem – when creating new VM there was no x64 version to choose. First thing that came to my mind was that probably virtualization was not enabled in BIOS. I checked but that was not it. Secondly I checked if my host machine has x64 OS installed (I was 99,99% sure, but sicher ist sicher, as Germans say :)). Lastly I found this nice blogpost about the same problem I had. It said that Hyper-V should be disabled, because if it is not, VirtualBox cannot access some virtualization stuff. You can turn off Hyper-V in “Turn Windows features on or off” in Control Panel -> Programs -> Programs and Features:
And that exactly was my problem. After I turned Hyper-V off the selection of x64 OSs was possible. In case of the same problem you have to:
- Check if your host OS is x64.
- Check if your computer supports virtualization – if it does, enable it in BIOS.
- Check if you have Hyper-V enabled – if it is, disable it.
If those conditions are met it should work.
LsaLookupSids
One of my coworkers got married and changed her surname. After my colleague changed her domain user strange thing happened. We are using domain authentication on our web portal. After domain user change she didn’t have any rights on the portal anymore. I checked the log (I am using Elmah) and there it was: Validation failed for one or more entities. The strangest thing was that under User column there was old surname, not the new one! Firstly I checked AD. Everything was fine. Then I tried to restart web page and IIS – it didn’t help. Server reboot was out of option.
After that I asked uncle Google, if he knows anything about that stuff. And he directed me to stackoverflow article. To work around this issue you can do following:
- Open registry editor as admin (on Windows Server 2008 and newer you can find it via searchbox (type regedit) on older versions you can run it via Run).
- Locate following subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
- Right-click on it, point to New and click DWORD Value.
- Type in LsaLookupCacheMaxSize and press Enter.
- Set value to 0 and exit registry editor.
Warning: this registry entry disables local SID caching. Because local SID cache helps to reduce domain controller workload and network traffic I deleted this registry entry after I checked that cache doesn’t hold deprecate username value anymore.
You can also check solution on official Microsoft support page.
How to override IIS default error messages?
Today I was working on retrieving status codes in ASP.NET MVC 4 application. I needed correct status codes for my ajax requests to show correct error message (in case of an error, of course). The problem was that IIS was redirecting when status code was added to response. In case of status code 401 it redirected to basic login, in case of status code 403 it redirected to IIS generic error page and so on. If you are working with .NET version 4.5 there exists very simple solution:
Response.TrySkipIisCustomErrors = true;
But not with .NET version 4.0. 🙂 In that case you have to add few lines into your Web.config file inside of system.webServer node:
<httpErrors existingResponse="PassThrough"> <remove statusCode="403"/> <error statusCode="403" responseMode="ExecuteURL" path="~/StatusCode/Unauthorized"/> <remove statusCode="401"/> <error statusCode="401" responseMode="ExecuteURL" path="~/StatusCode/Forbidden"/> <remove statusCode="404"/> <error statusCode="404" responseMode="ExecuteURL" path="~/StatusCode/NotFound"/> </httpErrors>
With attribute value “PassThrough” (attribute existingResponse) you tell IIS to leave response untouched if an existing response exists. You can check other attribute options here. Value of attribute path inside of node error represents the path to the response (for example: “~/ControllerName/ActionName”). That way you can override IIS’ default error responses with your custom error responses.
How to redirect non-www to www and domain to subdomain?
I recently wanted to permanently redirect all non-www urls to www urls and after that temporarily redirect everything to some subdomain. I found out that all that can be achieved with only few lines in .htaccess file:
# turn rewrite engine on RewriteEngine On # permanently (R=301) redirected example.com to www.example.com RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*) http://www.example.com/$1 [R=301,L] # temporarily (R=302) redirected www.example.com to subdomain.example.com RewriteCond %{HTTP_HOST} ^www.example.com$ [NC] RewriteRule ^(.*) http://subdomain.example.com/$1 [R=302,L]
As simple as that. 🙂