brandonmartinez

Resolve an HTTP Error 500.21 in IIS

If you’ve setup a new IIS website and app pool and try hosing a .NET application, you may run into this error: HTTP Error 500.21 – Internal Server Error Handler “ExtensionlessUrlHandler-Integrated-4.0″ has a bad module “ManagedPipelineHandler” in its module list.

HTTP Error 500.21 - Internal Server Error Handler ExtensionlessUrlHandler-Integrated-4.0 has a bad module ManagedPipelineHandler in its module list

Luckily, it’s very easy to resolve. Run the follow command from an elevated command prompt:

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

If you’re on a 32-bit machine, you may have to use the following:

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

Reinstall ASP.NET in IIS

Try reloading your site; you should be set to go!

SSMS Tip: Disable “Saving Changes Is Not Permitted” Warning

If you’ve ever experienced the dreaded Saving changes is not permitted dialog in SQL Management Studio, this tip is for you.

01-SaveNotPermitted

To disable the message, open the Tools -> Options menu and navigate to Designers -> Table and Database Designers:

02-UncheckPreventSaving

From there uncheck the Prevent saving changes that require table re-creation checkbox. Hit the OK button and you’ll be all set.

While this change might not be recommended if you’re in a production environment, it’s great to get rid of this block when you’re developing and designing your databases.

Temporarily Disable All T-SQL Table Constraints in a Database

After generating a set of scripts to import production data to a local development database, I ran into an issue with constraints blocking the inserts (this is on a fresh database structure). To get around the issue, execute this T-SQL command on your database:

EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"

You can now insert data without constraints blocking the action. Once you’ve finished the import, you can re-enable all constraints using this command:

EXEC sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"

And please, don’t use this on a production database! Development or testing only!

One more tip: if you see the following error, you’ve most likely inserted data that violates one of your constraints. Check to make sure all of your inserts have succeeded.

The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_YOUR_FOREIGN_KEY_CONSTRAINT".

Page 1 of 2712345...1020...»
Copyright © 2006 – 2014, Brandon Martinez. All rights reserved. A Martinez Media site.