Joseph Michael Pesch
VP Programming

LINQ to SQL with WCF and Silverlight

by 7. February 2010 19:27

Tags: ,

ASP.Net | LINQ to SQL | Silverlight

Binary Data Serialization LINQ to SQL via Web Service

by 7. February 2010 18:17

http://geekswithblogs.net/frankw/archive/2008/08/29/serialization-issue-with-timestamp-in-linq-to-sql.aspx

In summary, one easy fix is manually change the LINQ data type from Binary (System.Data.Linq.Binary) to byte[] (System.Byte[])

Tags: ,

ASP.Net | LINQ to SQL

ASP.Net Read HTML Content from URL

by 5. February 2010 04:49

public static string GetHTMLFromURL(string URL)
{   
  // Download page content   
  WebClient MyWebClient = new WebClient();   
  Byte[] PageHTMLBytes;   
  PageHTMLBytes = MyWebClient.DownloadData(URL);    
  // Convert result from byte array to string   
  UTF8Encoding oUTF8 = new UTF8Encoding();   
  return oUTF8.GetString(PageHTMLBytes); 
}

Tags: ,

ASP.Net

ASP.Net Webservice via WebRequest with SOAP Message

by 27. January 2010 23:08

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebServiceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Net.WebRequest req = System.Net.WebRequest.Create("https://api.somesite.com/somewebservice");
            req.Method = "POST";

            string cre = String.Format("{0}:{1}", "User.Name@WebSite.com", "MyPasswordHere");
            byte[] bytes = System.Text.Encoding.ASCII.GetBytes(cre);
            string base64 = Convert.ToBase64String(bytes);
            req.PreAuthenticate = true;
            req.Headers.Add("Authorization", "basic " + base64);

            StringBuilder SOAPRequestBody = new StringBuilder();
            SOAPRequestBody.Append("<?xml version=\"1.0\"?>");
            SOAPRequestBody.Append("<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">");
            SOAPRequestBody.Append("<S:Body>");
            SOAPRequestBody.Append("<ns2:getListInfo xmlns:ns2=\"http://service.somesite.com/\">");
            SOAPRequestBody.Append("</ns2:getListInfo>");
            SOAPRequestBody.Append("</S:Body>");
            SOAPRequestBody.Append("</S:Envelope>");

            req.ContentType = "application/soap+xml; charset=utf-8";
            req.ContentLength = SOAPRequestBody.Length;
            System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(req.GetRequestStream());
            streamWriter.Write(SOAPRequestBody);
            streamWriter.Close();
            System.IO.StreamReader streamReader = new System.IO.StreamReader(req.GetResponse().GetResponseStream());
            string strResponse = "";
            while (!streamReader.EndOfStream)
                strResponse += streamReader.ReadLine();
            streamReader.Close();

            System.Net.WebResponse resp = req.GetResponse();

        }

    }
}

Tags: ,

ASP.Net

Network Issues on Vista with VMware Workstation or Player

by 26. January 2010 16:33

 

Network Issues on Vista with VMware workstation.doc (87.50 kb)

1.            Click Start, click Run, type regedit, and then click OK.

2.            Click the following subkey:

HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}

3.            Browse through the 00xx subkeys until you find the REG_SZ VMNet subkey with a value of either
“\DosDevices\VMnet8” or “\DosDevices\VMnet1” (default values)

4.            On the Edit menu, point to New, and then click DWORD Value.

5.            Type *NdisDeviceType, and then press Enter. 

6.            On the Edit menu, click Modify.

7.            Type 1, and then click OK.

8.            Exit Registry Editor.

9.            Disable & re-enable the VMWare NICs

10.          Done

Note: If simply disabling and re-enabling the virtual NICs doesn’t fix the problem, immediately reboot.

 

 

Tags: ,

[None]

Email Current HTML Page with ASP.Net

by 24. January 2010 04:57

  /// <summary>
  /// Overridden to handle Confirmation of the order by
  /// capturing the HTTP output and emailing it.
  /// </summary>
  /// <param name="writer"></param>
  protected override void Render(HtmlTextWriter writer)
  {
    // *** Write the HTML into this string builder
    StringBuilder sb = new StringBuilder();
    StringWriter sw = new StringWriter(sb);
    HtmlTextWriter hWriter = new HtmlTextWriter(sw);
    base.Render(hWriter);
    // *** store to a string
    string PageResult = sb.ToString();
    // *** Write it back to the server
    writer.Write(PageResult);
    // *** Do something with the PageResult here like email it...
  }

Tags: ,

ASP.Net | C#

Outlook Corrupted PST File

by 19. January 2010 18:16

Try using: C:\Program Files\Microsoft Office\Office12\scanpst.exe to repair file.  For files larger that 2GB, use PST2GB tool to truncate file: http://www.microsoft.com/downloads/details.aspx?FamilyID=B33B1DFF-6F50-411D-BBDF-82019DDA602E&displaylang=en

Tags: ,

Outlook

Excel Macro to Re-Order Columns Based on Comma Delimited List

by 13. January 2010 18:24

This script will take the comma delimited values in the list variable, search for those values in the header row and reorder the columns in the corresponding order as the list.

Sub FormatFile()
    Dim iColTarget As Integer
    iColTarget = 0
    Dim iColSource As Integer
    Dim list As String
    list = "Date,Time,DNIS,ANI,Call Type,Duration,Hold Time,Handle Time,Rate,Cost,Disposition,Campaign,Agent,Comments,Number1,Number2,Number3,First_Name,Last_Name,Company,Street,City,State,Zip,Language,Impac Loan Number,Email Address,MailZip,MailAddress,MailCity,MailState,ContactComments"
    For Each listval In Split(list, ",")
      iColTarget = iColTarget + 1
      Rows(1).Select 'Select header row to search
      Cells.Find(What:=listval, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
            :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
            False, SearchFormat:=False).Activate
      iColSource = ActiveCell.Column
      Debug.Print listval & ": is located in column: " & iColSource & "; moving to column: " & iColTarget
      If iColSource <> iColTarget Then
        Columns(iColSource).Select
        Selection.Cut
        Columns(iColTarget).Select
        Selection.Insert Shift:=xlToRight
      End If
    Next
End Sub

Tags: ,

[None]

HTML Page Break (Printing Page Break)

by 10. December 2009 17:10

You can use the CSS style tag on an element as shown below.  NOTE: The &nbsp; within the <P> tag is important as the page break will be ignored if the tag has no contents.

<P style="page-break-before: always;">&nbsp;</P>

Tags: ,

[None]

C# Overlay Two Images

by 17. November 2009 21:25

[No text]

Tags: ,

[None]

C# Rotate Image

by 17. November 2009 21:24

Excerpt from: http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-rotate

private Bitmap rotateImage(Bitmap b, float angle)
{
  //create a new empty bitmap to hold rotated image
  Bitmap returnBitmap = new Bitmap(b.Width, b.Height);
  //make a graphics object from the empty bitmap
  Graphics g = Graphics.FromImage(returnBitmap);
  //move rotation point to center of image
  g.TranslateTransform((float)b.Width/2, (float)b.Height / 2);
  //rotate
  g.RotateTransform(angle);
  //move image back
  g.TranslateTransform(-(float)b.Width/2,-(float)b.Height / 2);
  //draw passed in image onto graphics object
  g.DrawImage(b, new Point(0, 0));
  return returnBitmap;
}

Tags: ,

Excel

SQL Server Common Table Expression (CTE)

by 12. November 2009 18:00

Must have semi-colon on last statement before the "WITH" keyword that begins the Common Table Expression (see sample below on "select @Dummy = 0;" line).  Multiple CTE's must be comma delimited under the single "WITH" keyword (i.e. only the first CTE begins with the "WITH" statement, the subsequent ones begin with a comma).

declare

  @BegDate datetime

, @EndDate datetime

, @Dummy int

 

select

  @BegDate ='2/1/2009'

, @EndDate ='2/28/2009 11:59PM'

 

select @Dummy = 0;-- Prepare for the WITH CTE statement

 

with HistoryMax(ModificationID, HistoryDate)as

(

  select ModificationID,max(HistoryDate) HistoryDate

  from LMM.TermsHistory

  where HistoryDate <= @EndDate

  groupby ModificationID

)

, TermSnap(HistoryID)as

(

  select HistoryID

  from LMM.TermsHistory h

  innerjoin HistoryMax hm on h.ModificationID = hm.ModificationID

  and h.HistoryDate = hm.HistoryDate

)

, FilterSet(ModificationID, ModificationStatusCodeDate)as

(

  select ModificationID,max(ModificationStatusCodeDate) ModificationStatusCodeDate

  from LMM.TermsHistory

  where ModificationstatusCode = 600

  groupby ModificationID

)

 

select

  datename(month, h.ModificationStatusCodeDate) ClosedMonth

,sum(isnull(fc1.FeeAmount, 0)+isnull(fc2.FeeAmount, 0)) FeeCollected

,sum(isnull(fp1.FeeAmount, 0)+isnull(fp2.FeeAmount, 0)) FeePending

from

  LMM.TermsHistory t

  innerjoin TermSnap ts

  on t.HistoryID = ts.HistoryID

  innerjoin FilterSet h

  on t.ModificationID = h.ModificationID

  leftouterjoin LMM.ModCalcFee fc1

  on fc1.RecordTypeCode = 100

     and fc1.FeeCollectedFlag = 1

     and t.ModificationID = fc1.ModificationID

  leftouterjoin LMM.ModCalcFee fc2

  on fc2.RecordTypeCode = 200

     and fc2.FeeCollectedFlag = 1

     and t.ModificationID = fc2.ModificationID

  leftouterjoin LMM.ModCalcFee fp1

  on fp1.RecordTypeCode = 100

     and fp1.FeeCollectedFlag = 0

     and t.ModificationID = fp1.ModificationID

  leftouterjoin LMM.ModCalcFee fp2

  on fp2.RecordTypeCode = 200

     and fp2.FeeCollectedFlag = 0

     and t.ModificationID = fp2.ModificationID

where

  h.ModificationStatusCodeDate between @BegDate and @EndDate

  and t.ModificationStatusCode between 600 and 899

groupby

  datename(month, h.ModificationStatusCodeDate)

 

Tags: ,

SQL Server

SQL 2005 Select Into Variable with Multiple Rows

by 10. November 2009 14:50

When using a select statement to set a variable, and the select statement returns multiple rows, the last row returned will be the value stored in the variable. You can use sorting or a TOP statement to change this behaviour (as shown in samples below).
 

createtable #tmp(val int) 

insertinto #tmp values(1)
insertinto #tmp values(2)
insertinto #tmp values(3)
insertinto #tmp values(4)
insertinto #tmp values(5) 

declare @val int

selecttop 1 @val = val
from #tmp
orderby val asc select @val /* returns 1 */ 

select @val = val
from #tmp
orderby val asc select @val /* returns 5 */ 

select @val = val
from #tmp
orderby val desc select @val /* returns 1 */ 

droptable #tmp

Tags: ,

SQL Server

LINQ Dynamic Order By on IQuerable Object

by 2. November 2009 23:24

private IQueryable<ClientInfo> OrderBy(IQueryable obj){

  ParameterExpression param = Expression.Parameter(typeof(ClientInfo), string.Empty);

  MemberExpression property = Expression.PropertyOrField(param, this.SortExpressionLabel.Text);  

  LambdaExpression sort = Expression.Lambda(property, param); 

  string methodName = "OrderBy"; 

  if (SortDirectionLabel.Text == "DESC")  methodName += "Descending"; 

  MethodCallExpression call = Expression.Call(typeof(Queryable), methodName, new[] { typeof(ClientInfo), property.Type },      obj.Expression, Expression.Quote(sort)); 

  return obj.Provider.CreateQuery<ClientInfo>(call);

}

Tags: ,

LINQ to SQL

Compare Two Tables in SQL Server

by 21. October 2009 16:26

Code excerpt from: http://weblogs.sqlteam.com/jeffs/archive/2004/11/10/2737.aspx

 

 

 

SELECT MIN(TableName) as TableName, ID, COL1, COL2, COL3 ...

FROM

(

  SELECT 'Table A' as TableName, A.ID, A.COL1, A.COL2, A.COL3, ...

  FROM A

  UNION ALL

  SELECT 'Table B' as TableName, B.ID, B.COL1, B.COl2, B.COL3, ...

  FROM B

) tmp

GROUP BY ID, COL1, COL2, COL3 ...

HAVING COUNT(*) = 1

ORDER BY ID

Tags: ,

SQL Server

Rounded Corners In Photoshop

by 7. October 2009 23:55

1) Draw new layer with the "Rounded Rectangle Tool" (radius of 25px is usually pretty good for corners).

2) On the new layer that you just drew the rounded corners on select the "Paths" tab and then click the little right-arrow to get the drop-down menu, from that menu select "Make Selection" (make sure the "Feather Radius" is 0 and the "Anti-aliased" is checked).

3) Edit > Copy (or CTRL+C)

4) File > New ("Background Contents" = "Transparent")

5) Edit > Paste (or CTRL+V)

 

Tags: ,

[None]

Turn Off Windows Hibernation

by 1. October 2009 19:20

Delete hiberfil.sys in Vista

Here’s a way to turn off hibernation and free up a couple of gigs on your system drive…

Click Start, All Programs, Accessories, right click on “Command Prompt”, and then click “Run as Administrator”. If User Account Control (UAC) asks you for permission, permit the Command Prompt to run.

Next, type “powercfg -h off” (without the quotes), followed by pressing Enter.

Close the Command Prompt window and restart.

Original post from: http://www.abxzone.com/forums/f109/delete-hiberfil-sys-vista-105337.html

Tags: ,

Vista

SQL Beginning of Day and End of Day (getdate() Date Only)

by 16. August 2009 21:05

declare
@ProcessDate datetime
, @ProcessDateMin datetime
, @ProcessDateMax datetime

set @ProcessDate =getdate()

set @ProcessDateMin =convert(datetime,floor(convert(float, @ProcessDate)))

set @ProcessDateMax =dateadd(hour, 23,dateadd(minute, 59,dateadd(second, 59, @ProcessDateMin)))


select @ProcessDate ProcessDate, @ProcessDateMin ProcessDateMin, @ProcessDateMax ProcessDateMax

ProcessDate             ProcessDateMin          ProcessDateMax
----------------------- ----------------------- -----------------------
2009-08-16 15:18:16.233 2009-08-16 00:00:00.000 2009-08-16 23:59:59.000

Tags: ,

SQL Server

Excel Automation Example

by 10. August 2009 12:20

EXCEL AUTOMATION SAMPLE:

using Microsoft.Office.Interop.Excel;

public partial class LoanMod_IncomeExpenseWorksheet : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    ExcelOpenSpreadsheets(Server.MapPath("~/Excel/MAG-Financial-Statement.xls"));
  }
  /// <summary>
  /// Open the file path received in Excel. Then, open the workbook
  /// within the file. Send the workbook to the next function, the internal scan
  /// function. Will throw an exception if a file cannot be found or opened.
  /// </summary>
  private void ExcelOpenSpreadsheets(string FileName)
  {
    Application _excelApp = new Application();
    try
    {
      //
      // This mess of code opens an Excel workbook. I don't know what all
      // those arguments do, but they can be changed to influence behavior.
      //
      Workbook workBook = _excelApp.Workbooks.Open(FileName,
          Type.Missing, Type.Missing, Type.Missing, Type.Missing,
          Type.Missing, Type.Missing, Type.Missing, Type.Missing,
          Type.Missing, Type.Missing, Type.Missing, Type.Missing,
          Type.Missing, Type.Missing);

      //
      // Pass the workbook to a separate function. This new function
      // will iterate through the worksheets in the workbook.
      //
      ExcelScanIntenal(workBook);

      //
      // Clean up.
      //
      workBook.Close(false, FileName, null);
    }
    catch
    {
      //
      // Deal with exceptions.
      //
    }
  }
  /// <summary>
  /// Scan the selected Excel workbook and store the information in the cells
  /// for this workbook in an object[,] array. Then, call another method
  /// to process the data.
  /// </summary>
  private void ExcelScanIntenal(Workbook workBookIn)
  {
    //
    // Get sheet Count and store the number of sheets.
    //
    int numSheets = workBookIn.Sheets.Count;

    //
    // Iterate through the sheets. They are indexed starting at 1.
    //
    for (int sheetNum = 1; sheetNum < numSheets + 1; sheetNum++)
    {
      Worksheet sheet = (Worksheet)workBookIn.Sheets[sheetNum];
      Response.Write(sheet.Name + "<br />");
      //
      // Take the used range of the sheet. Finally, get an object array of all
      // of the cells in the sheet (their values). You can do things with those
      // values. See notes about compatibility.
      //
      Range excelRange = sheet.UsedRange;
      object[,] valueArray = (object[,])excelRange.get_Value(
          XlRangeValueDataType.xlRangeValueDefault);

      //
      // Do something with the data in the array with a custom method.
      //
      // ProcessObjects(valueArray);
    }
  }
}

Tags: ,

[None]

Workflow Foundation Error with Distributed Transaction Coordinator

by 7. August 2009 20:26

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Workflow.Runtime.Hosting.PersistenceException: Communication with the underlying transaction manager has failed. ---> System.Transactions.TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed. ---> System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
  at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32 propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier, Guid& transactionIdentifier, OletxTransactionIsolationLevel& isolationLevel, ITransactionShim& transactionShim)
  at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)
  --- End of inner exception stack trace ---
  at System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService.System.Workflow.Runtime.IPendingWork.Commit(Transaction transaction, ICollection items)
  at System.Workflow.Runtime.WorkBatch.PendingWorkCollection.Commit(Transaction transaction)
  at System.Workflow.Runtime.WorkBatch.Commit(Transaction transaction)
  at System.Workflow.Runtime.VolatileResourceManager.Commit()
  at System.Workflow.Runtime.WorkflowExecutor.DoResourceManagerCommit()
  at System.Workflow.Runtime.Hosting.WorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)
  at System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)
  at System.Workflow.Runtime.WorkflowExecutor.CommitTransaction(Activity activityContext)
  at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)
  --- End of inner exception stack trace ---
  at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)
  at System.Workflow.Runtime.WorkflowExecutor.PerformUnloading(Boolean handleExceptions)
  at System.Workflow.Runtime.WorkflowExecutor.Unload()
  at System.Workflow.Runtime.WorkflowInstance.Unload()
  at BidMortgageWFWebService.StateMachineWF.NewSubmission(Guid LoanRequestID, Nullable`1 BiddingTimespan)
  at BidMortgageWFWebService.StateMachineWF.NewSubmissionWithBiddingTimeSpan(Guid LoanRequestID, Int32 Days, Int32 Hours, Int32 Minutes, Int32 Seconds)
  --- End of inner exception stack trace ---

To solve the error above, make sure the ports highlighted below are open (bi-directional) between the web and sql servers.

RPC server programs typically use dynamic port mappings to avoid conflicts with programs and protocols registered in the range of well-known TCP ports. RPC server programs associate their universally unique identifier (UUID) with a dynamic port and register the combination with the RPC EPM. The EPM provides a single point of contact for RPC clients. The RPC clients contact the EPM and use the server program’s UUID to determine the port being used by the server program. The following table indicates the network ports normally used by RPC.

Network Port Assignments for RPC 

Service Name UDP TCP
HTTP 80, 443, 593 80, 443, 593
Named Pipes 445 445
RPC Endpoint Mapper 135 135
RPC Server Programs <Dynamically assigned> 1024-5000 <Dynamically assigned> 1024-5000

Prior to the above error the errors below were occuring due to the lack of configuration settings shown below.

Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool.

NOTE: When enabling settings shown below on the web server only (i.e. before performing same setting on sql server) I got the following error:

The partner transaction manager has disabled its support for remote/network transactions.

Steps to change settings

On Windows Server 2003 SP1 and Windows XP SP2:

1.     Click Start, click Run, and type dcomcnfg to launch the Component Services Management console.

2.     Click to expand Component Services and click to expand Computers.

3.     Right-click My Computer, and click Properties.

4.     Click the MSDTC tab of the My Computer Properties dialog and click the Security Configuration button to display the Security Configuration dialog box.

On Windows Server 2008 and Windows Vista:

1.     Click Start, click Run, and type dcomcnfg to launch the Component Services Management console.

2.     Click to expand Component Services and click to expand Computers.

3.     Click to expand My Computer, click to expand Distributed Transaction Coordinator, right-click Local DTC, and click Properties.

4.    Click the Security tab of the Local DTC Properties dialog. 

WEB SERVER 2008 

  

 

SQL SERVER 2003 

The following is from this link: http://support.microsoft.com/kb/250367 

You can configure DTC to communicate through firewalls, including network address translation firewalls.

DTC uses Remote Procedure Call (RPC) dynamic port allocation. By default, RPC dynamic port allocation randomly selects port numbers above 1024. By modifying the registry, you can control which ports RPC dynamically allocates for incoming communication. You can then configure your firewall to confine incoming external communication to only those ports and port 135 (the RPC Endpoint Mapper port).

You must provide one incoming dynamic port for DTC. You may need to provide additional incoming dynamic ports for other subsystems that rely on RPC.

The registry keys and values described in this article do not appear in the registry by default; you must add them by using Registry Editor.

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:

322756  (http://support.microsoft.com/kb/322756/ ) How to back up and restore the registry in Windows


Follow these steps to control RPC dynamic port allocation. You will have to do this on both computers. Note also that the firewall mustbe open in both directions for the specified ports:

  1. To start Registry Editor, click Start, click Run, type regedt32, and then click OK.

    You must use Regedt32.exe, rather than Regedit.exe, because Regedit.exe does not support the REG_MULTI_SZ data type that is required for the Ports value.
  2. In Registry Editor, click HKEY_LOCAL_MACHINE in the Local Machine window.
  3. Expand the tree by double-clicking the folders named in the following path:
    HKEY_LOCAL_MACHINE\Software\Microsoft\Rpc
  4. Click the RPC folder, and then click Add Key on the Edit menu.
  5. In the Add Key dialog box, in the Key Name box, type Internet, and then click OK.
  6. Click the Internet folder, and then click Add Value on the Edit menu.
  7. In the Add Value dialog box, in the Value Name box, type Ports.
  8. In the Data Type box, select REG_MULTI_SZ, and then click OK.
  9. In the Multi-String Editor dialog box, in the Data box, specify the port or ports you want RPC to use for dynamic port allocation, and then click OK.

    Each string value you type specifies either a single port or an inclusive range of ports. For example, to open port 5000, specify "5000" without the quotation marks. To open ports 5000 to 5020 inclusive, specify "5000-5020" without the quotation marks. You can specify multiple ports or ports ranges by specifying one port or port range per line. All ports must be in the range of 1024 to 65535. If any port is outside this range or if any string is invalid, RPC will treat the entire configuration as invalid.

    Microsoft recommends that you open up ports from 5000 and up, and that you open a minimum of 15 to 20 ports.
  10. Follow steps 6 through 9 to add another key for Internet, by using the following values:
    Value: PortsInternetAvailable
    Data Type: REG_SZ
    Data: Y
    This signifies that the ports listed under the Ports value are to be made Internet-available.
  11. Follow steps 6 through 9 to add another key for Internet, by using the following values:
    Value: UseInternetPorts
    Data Type: REG_SZ
    Data: Y
    This signifies that RPC should dynamically assign ports from the list of Internet ports.
  12. Configure your firewall to allow incoming access to the specified dynamic ports and to port 135 (the RPC Endpoint Mapper port).
  13. Restart the computer. When RPC restarts, it will assign incoming ports dynamically, based on the registry values that you have specified. For example, to open ports 5000 through 5020 inclusive, create the following named values:
    Ports : REG_MULTI-SZ : 5000-5020
    PortsInternetAvailable : REG_SZ : Y
    UseInternetPorts : REG_SZ : Y

DTC also requires that you are able to resolve computer names by way of NetBIOS or DNS. You can test whether or not NetBIOS can resolve the names by using ping and the server name. The client computer must be able to resolve the name of the server, and the server must be be able to resolve the name of the client. If NetBIOS cannot resolve the names, you can add entries to the LMHOSTS files on the computers.

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

217351  (http://support.microsoft.com/kb/217351/ ) DCOM port range configuration problems

For more information about LMHOSTS files, click the following article number to view the article in the Microsoft Knowledge Base:

102725  (http://support.microsoft.com/kb/102725/ ) LMHOSTS file information and predefined keywords

Tags: ,

ASP.Net | Windows Communication Foundation