Determine the correct w3wp.exe process ID, to attach the Microsoft Visual Studio debugger to, by using the Windows Task Manager

If you have multiple application pools started in IIS 7 and you want to determine which w3wp.exe process to attach the Microsoft Visual Studio 2010 debugger to, you can use the Microsoft Windows Task Manager.

Start the Microsoft Windows Task Manager: press [Ctrl + Shift + Esc].

Add the columns "PID" and "Command Line" to the Process tab.

image

 

The name of the application pool will be shown in the Command Line Column.

In this case the WCF service I wanted to debug, was running on the default [ASP.NET v4.0] application pool.

The Microsoft Windows Task Manager, shows the PID of this w3wp.exe processes as 8188, so now I can attach the Microsoft Visual Studio debugger, to the process with ID 8188, to start debugging the WCF service

Using anonymous authentication on a .NET 4.0 WCF service that calls another WCF service

Let’s say you created a ASP .NET 4.0 website that uses a WCF service to get data from a Microsoft SQL Server database.

The website uses anonymous authentication and you are asked to show data on the website from another WCF service that use anonymous authentication:

 

image

 

By default wsHttpBinding uses windows authentication, so if you want to use wsHttpBinding in this scenario, you will have to disable authentication on both the WCF Server [A] binding as the WCF Service [B] binding.

This can be done, by setting the security mode to none on the binding and setting clientCredentialType to None on the transport and message nodes:

 

WCF Service [A] Web.config:

<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMyServiceB" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:64043/MyServiceB.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyServiceB" contract="ADAICT.IMyServiceB" name="WSHttpBinding_IMyServiceB" />
</client>

 

WCF Service [B] Web.config

<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<wsHttpBinding>
                <binding name="AnonymousBinding">
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>

 <service behaviorConfiguration="WcfServiceBehavior" name="MyServiceB">
<endpoint binding="wsHttpBinding" bindingConfiguration="AnonymousBinding"
contract="IMyServiceB" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<timeouts openTimeout="23:59:59" />
</host>
</service>

This allows the WCF Service [A] to communicate with WCF Service [B] on wsHttpBinding with anonymous access.

To copy the contents of a folder to an other folder, including all subfolders in C#

To copy the contents of a folder to an other folder, including all subfolders, overwriting existing files, you can use the following function in C#:

 

/// <summary>
/// Copies the contents of a folder, including subfolders to an other folder, overwriting existing files
/// </summary>
/// <param name="sourceFolder"></param>
/// <param name="destinationFolder"></param>
public static void CopyFolderContents(string sourceFolder, string destinationFolder)
{
if (Directory.Exists(sourceFolder))
{
// Copy folder structure
foreach (string sourceSubFolder in Directory.GetDirectories(sourceFolder, "*", SearchOption.AllDirectories))
{
Directory.CreateDirectory(sourceSubFolder.Replace(sourceFolder, destinationFolder));
}
// Copy files
foreach (string sourceFile in Directory.GetFiles(sourceFolder, "*", SearchOption.AllDirectories))
{
string destinationFile = sourceFile.Replace(sourceFolder, destinationFolder);
File.Copy(sourceFile, destinationFile, true);
}
}
}

Solving: Search in "All Mail Items" in Microsoft Outlook 2010, does not return any result

When you have instant search disabled, searching in Microsoft Outlook by using the "All Mail Items" button, does not return any result:

 

image

 

Solution

To search in "All Mail Items", without having instant search enabled, you must first enable "All folders" in the search results options:

image

 

image

 

Make sure you’re account is included in the "Locations to Search"

image

Using Microsoft Outlook 2010 with BPOS without local *.ost file.

Install Microsoft Outlook 2010, after installing don’t start Microsoft Outlook 2010, first create a mail profile in Start > Control Panel > Mail

Follow the steps on http://blogs.technet.com/b/simonmay/archive/2010/08/16/manually-configure-outlook-2010-for-exchange-online-bpos.aspx to manually connect Microsoft Outlook 2010 to BPOS.

 

Except for the screen below: Uncheck [Use Cached Exchange Mode]

 

image

Scripting triggers in Microsoft SQL Server

By default when you use the Script Wizard in Microsoft SQL Server Management Studio to script objects in a database, triggers are note included.

You can include triggers if you [Include all objects] and [Set triggers= true] during the Script Wizard.

 

To start the script wizard, right click the database that contains the triggers.

Choose Tasks > Generate Scripts…

 

image

 

Check the [Script all objects in the selected database]

 

image

 

Set the [Script Triggers = True]

image

 

image

 

image

 

image

 

The generate script will now contain all triggers in the database.

It will not generate drop statements for the triggers

So you should at [drop trigger] if it exists, before executing the generated create trigger statements:

For example the script wizard generates:

CREATE TRIGGER [trd_Order] on [Order]
AFTER DELETE
AS
INSERT Audit_Order
SELECT *, 'V',0,getdate()
,    null
,    null
FROM deleted
END
GO

Then you should change this to:

IF OBJECT_ID ('trd_Order', 'TR') IS NOT NULL
BEGIN
DROP TRIGGER trd_Order
END
CREATE TRIGGER [trd_Order] on [Order]
AFTER DELETE
AS
INSERT Audit_Order
SELECT *, 'V',0,getdate()
,    null
,    null
FROM deleted
END
GO

Fixing the VS2010 sp1 error: The command you are attempting cannot be completed because the file …vdproj is under source code control and is not checked out

After installing Microsoft Visual Studio 2010 sp1 I was getting the error:

Fixing the VS2010 sp1 error: The command you are attempting cannot be completed because the file …vdproj is under source code control and is not checked out

 

When I build a solution.

 

image

 

Solution

Downloading and installing the hotfix:

http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=35848 solved my problem

Using the sysdtslog90 table for logging package (user) variables in Microsoft SQL Server 2005 Integration Services

The sysdtslog90 table is used by Microsoft SQL Server 2005 SSIS to log messages. If you want to use this table for custom logging, you can user event handlers on SSIS tasks.

– Select the task that uses a package variable

– Click on the tab [Event Handlers]

– Select [OnPreExecute], if you want to log the value of the parameter before the task is executed.

– Select [OnPostExecute], if you want to log the value of the parameter after the task is executed.

– Add a SQL Task from the Toolbox (control flow items)

image

– Use the following parameter mappings (the User::FileOutputPath is the package variable I want to log):

image

– Use as query:

image

-- Determine current date and time
declare @now datetime
select @now = getdate()
declare @up1 nvarchar(128)
declare @up2 nvarchar(128)
declare @up3 nvarchar(128)
declare @up4 nvarchar(128)
declare @up5 nvarchar(128)
set @up1 = ?
set @up2 = ?
set @up3 = ?
set @up4 = ?
set @up5 = ?
declare @message nvarchar(2048)
set @message = 'FileOutputPath=[' + isnull(?, ' ') + ']'
-- Add a record to the table [ZKP_Audit].[dbo].[sysdtslog90]
exec sp_dts_addlogentry 
'OnPreExecute',                -- [event]:        Eventname
@up1,                    -- [computer]:    Machinename
@up2,                    -- [operator]:    Username
@up3,                    -- [source]:    Taskname
@up4,                    -- [sourceid]:    Task GUID
@up5,                    -- [executionid]:    Package GUID
@now,                    -- [starttime]:    Current date and time
@now,                    -- [endtime]:    Current date and time
0,                    -- [datacode]:    Not used, always 0
0x,                    -- [databytes]:    Not used, always 0x
@message                 -- [message]:    Message containing te parameterinformation

Result in the table sysdtslog90:

 

14    14    OnPreExecute    DEV2005    DEV2005\Administrator    Log package variables    5325CAAB-AC92-456E-B206-8DF8DA4081A8    013DC323-7A0D-48FC-BAA0-07074FC765EE    2011-05-12 11:28:44.947    2011-05-12 11:28:44.947    0    0x    FileOutputPath=[C:\Projects\De Grote Rivieren\Dagstaten\Solution\SSIS\ZKP_Dagstaten2Psygis\Files\Export\]

Solving: SQL Server Integration Services Script Task has stopped working in Microsoft SQL Server 2005 sp4 BIDS on Windows 2008 R2 sp1 x64 machine

I was getting the error "SQL Server Integration Services Script Task has stopped working", when I set a breakpoint in a script task in Microsoft SQL Server 2005 with sp4 BIDS on a Microsoft Windows 2008 R2 sp1 x64 machine.

Error

Description:
  Stopped working

Problem signature:
  Problem Event Name:    CLR20r3
  Problem Signature 01:    dtattach.exe
  Problem Signature 02:    9.0.242.0
  Problem Signature 03:    434f5e26
  Problem Signature 04:    Microsoft.VisualBasic.Vsa.DT
  Problem Signature 05:    8.0.0.0
  Problem Signature 06:    480d5c80
  Problem Signature 07:    21
  Problem Signature 08:    1a
  Problem Signature 09:    Microsoft.Vsa.VsaException
  OS Version:    6.1.7601.2.1.0.274.10
  Locale ID:    1043

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt

 

image

 

Solution

Setting the [Run64bitRuntime] = False on the debugging property page, solved my problem:

– Right click you’re SSIS project in Microsoft SQL Server 2005 BIDS and click on properties

– Click on Debugging en set [Run64bitRuntime] = False

 

image