# Thursday, 01 March 2012

This week I have been setting up a new development IIS 7.5 server.  I have three websites all bound to a separate port and I needed each to be setup with SSL.  This functionality is built into IIS 7+ but you can only set the name for the cert.  If you need to change other settings then you’ll need to use SelfSSL. 

SelfSSL comes with the IIS6 Resource Kit.  However, it has a problem.  It works on IIS7 BUT only for the last certificate that you create with it.  It’s a known bug and I couldn’t find a newer version of SelfSSL.

SelfSSL7 to the rescue

SelfSSL7 is the fix.  I found this after using a slew of variants in my search terms.  That’s the reason I’m posting this.  It seemed way too hard to find for me.

Using SelfSSL7

If you type selfssl7 at the command line with no options it will create a default certificate for you site. The command to set the number of days and site and port number is listed below.

selfssl7 /N cn=<computername> /V <length of days for certificate> /I /S "<Default Website>" /P <portnumber>

selfssl7 /n cn=mylocalboxname /V 365 /I /S "Dev" /P 4040 would set the validity of the certificate for one year to the Dev website and on port 4040.

Now you can create as many certs as you need on IIS7+ machines.  It can also handle multiple DNS names.

Happy Coding! Smile

iis7 | iis7.5 | SelfSSL | SelfSSL7 | SSL
Posted 03.01.2012  #    Comments [2]  | 
# Thursday, 01 December 2011

The Test Helpers are a great way to ease your testing needs with MVC.  If your using the Test Helpers to test your routing like so:

            "~/".ShouldMapTo<HomeController>(x => x.Index());

When you run your tests you’ll get the following error:

System.Security.VerificationException : Method MvcContrib.TestHelper.RouteTestingExtensions.ShouldMapTo: type argument 'Your Controller Name’ violates the constraint of type parameter 'TController'.

The fix is a binding direct.

Add an app.config to your test project and paste in the following:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Happy Coding! Smile

Posted 12.01.2011  #    Comments [7]  | 
# Wednesday, 09 November 2011

I don’t know about you but every SQL Server environment I’ve ran into is extremely well documented and easy to figure out the dependencies.wakeup

 

 

…And then I wake up.

 

 

Documented SQL Servers?

Ever have a question about where in your SQL Server stored procedures you used that particular piece of text?

Maybe you need to know where you used that CLR integrated function call in your SQL Server code base?

I recently began a new job and while getting myself up to speed on their, I mean our database environment I discovered that the server had CLR integrated functions.  Where are these being used? Nobody on the team could give me a straight answer.

sp_MSForeachdb to the rescue

This built-in little gem (undocumented) will loop through all your databases on a server.  It takes in a string as a command with the ? as a placeholder for the table name.

sp_MSForeachdb ' use ?; SELECT DISTINCT ''?'' as DbName, o.name AS OBJ_Name, o.type_desc FROM sys.sql_modules m INNER JOIN sys.objects o ON m.object_id=o.object_id WHERE (m.definition LIKE ''%YourTextToFind%'' )'

This will return an empty result set if the database does not have YourTextToFind in any of it’s stored procedures, views and functions.

When it does find it will look something like:

DbName OBJ_Name type_desc
DatabaseName SP, View, Function Name SQL_STORED_PROCEDURE, VIEW, SQL_SCALAR_FUNCTION

Now you are armed with a list of usages/dependencies.  It’s a simple man’s database documentation tool. 

I imagine the above code could be better written.  After all, I’m just an accidental DBA. Smile

Here’s some cool usages floating around on the interwebs.

Find the space used for each database.

Six common uses of sp_MSforeachdb.

There’s also sp_MSforeachtable….  I think you can guess just what you might do with that.

Happy Coding!

Posted 11.09.2011  #    Comments [0]  |