If you want to see the error page when you run the project from Visual Studio, you have to set the mode to ON.
<customErrors mode="On" defaultRedirect="error.htm">
When you set mode to RemoteOnly, it renders error pages to external users alone.
Refer this MSDN article for more details:
https://msdn.microsoft.com/en-us/library/bb397417(v=vs.140).aspx[
^]