Creating a WCF Client Part 1: svcutil.exe, self-signed certs and Fiddler
Last week I had the opportunity to create my first WCF (Windows Communication Foundation) client. Unfortunately, svcutil wasn't cooperating...
Error message:
WS-Metadata Exchange Error
URI: https://someURL/NewsFeed.svc?wsdl
Metadata contains a reference that cannot be resolved: 'https://someURL/NewsFeed.svc?wsdl.
Could not establish trust relationship for the SSL/TLS secure channel with authority 'someURL.
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
The remote certificate is invalid according to the validation procedure.
HTTP GET Error
URI: https://someURL/NewsFeed.svc?wsdl
There was an error downloading 'https://someURL/NewsFeed.svc?wsdl'.
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
The remote certificate is invalid according to the validation procedure.
Powershell Invoke-Expression and System PATH behavior
Invoke-Expression is a language feature that allows for capturing the output of a command line application for parsing by your powershell script. If you are not careful, though, you could be plagued with messages like these:
Invoke-Expression : You must provide a value expression on the right-hand side of the '-' operator.
At C:\Users\Administrator\temp\someScript.ps1:3 char:29
+ $results = Invoke-Expression <<<< $Action
+ CategoryInfo : ParserError: (:) [Invoke-Expression], ParseException
+ FullyQualifiedErrorId : ExpectedValueExpression,Microsoft.PowerShell.Commands.InvokeExpressionCommand
Escape Special Characters in SQL Queries
Quick note about some SQL Escape characters:
In SQL you get to define the escape character like so:
select *
from Item
where Name like '%/_%' escape '/'
In this example you will be finding anything in the 'Item' table which contains an underscore anywhere in the 'Name' column. The above syntax is equivalent to:
select *
from Item
where Name like '%=_%' escape '='
Which is equivalent to:
select *
from Item
where Name like '%~_%' escape '~'
For more SQL Escape character information, refer to:
Automate NFS mount creation on ESX hosts with PowerCLI
It can get tedious to go through and manually add/remove/update NFS Mounts on ESX hosts in a vCenter environment. Fortunately VMWare provides a slick solution which can be easily implemented if you are familiar with Microsoft PowerShell
Debugging Statements in Powershell Functions
Yesterday I needed to put together a simple powershell script to handle log file rotation. It should have been finished quickly- instead I got bogged-down in troubleshooting a simple issue with debug statements
Free resources to learn C#.NET and Powershell
Last week I had the opportunity to present a multi-day training course covering the technologies & troubleshooting techniques related to my employers flagship product. As part of the presentation I covered a couple of key technologies which are critical to our products: C#.NET and Powerhsell.
There are a couple of specific resources that have proven useful to us that I'd like to pass along here.
Rails db:create Error: Incorrect database name
While attempting to create a new Rails 3 application, I encountered an issue creating a MySQL Database. db:create returns an error message:
rake aborted!
Mysql2::Error: Incorrect database name 'testapp.net_test': CREATE DATABASE `testapp.net_test`
Finding Certificate Store names using Powershell
We have a lot of servers running Windows 2008 R2 Core edition. One difficulty of Windows core is that MMC (Microsoft Management Console) is unavailable. This can be problematic when you are working with certificates and just want a way of viewing what certificates are installed and their properties.
To help get around this issue I created a Powershell script to display the certificates and access their properties. I'd like to share some of what I learned in the process.
IIS Log file locations (Windows 2003 and 2008)
For quick reference, I'm posting the Default IIS log file locations for Windows Server 2003 and 2008.
Windows 2003:
- HTTP Log file location: C:\WINDOWS\system32\LogFiles\W3SVC1
- HTTP ERR (ERROR) log file location: c:\Windows\System32\LogFiles\HTTPERR
Windows 2008:
- HTTP Log file location: c:\inetpub\logs\LogFiles\W3SVC1
- HTTP ERR location: c:\Windows\System32\LogFiles\HTTPERR
Enabling SSL Access to AD LDS (Lightweight Directory Services)
We recently had some issues recently implementing SSL on a Active Directory Lightweight Directory Services box.
Here are some of the errors we were seeing:
- LDP.exe shows Cannot open connection when attempting connection using SSL over port 636
Windows System Event log:
- Description: A fatal error occurred when attempting to access the SSL server credential private key. The error code returned from the cryptographic module is 0x8009030d. The internal error state is 10001.
- Description: No suitable default server credential exists on this system. This will prevent server applications that expect to make use of the system default credentials from accepting SSL connections. An example of such an application is the directory server. Applications that manage their own credentials, such as the internet information server, are not affected by this.
Windows Security Event Log:
- Severity: FailureAudit
Date Time: 6/24/2011 6:56:48 PM
Source: Microsoft-Windows-Security-Auditing
Category: (12290)
Event ID: 5061