Wednesday, March 7, 2012

IIS error on New Subscription

hi. i was following the newbie's guide: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp?frame=true

on the creating a new subscription i was doing okay until i get to the last part wherein i click finish and this error pops up when it starts synchronizing data..

An error has occured on the computer running IIS. Try restarting the IIS server.

i already tried restarting the server.. is there anything else i can do to make it work?

Nijen,

There are many errors that can occur when synchronizing merge replication - the first thing you want to do is get as much information as possible and a specific error code. Place your call to repl.Synchronize() in a try/catch block and catch the specific exception that the SQL Mobile Client Agent throws during the replication. To traverse the SqlCe Exception object and extract the message information, use this method:

try{ repl.Synchronize(); }

catch (SqlCeException sqlex) { DisplaySQLCEErrors(sqlex);}

////////

public void DisplaySQLCEErrors(SqlCeException ex)
{
SqlCeErrorCollection errorCollection = ex.Errors;

StringBuilder bld = new StringBuilder();
Exception inner = ex.InnerException;

foreach (SqlCeError err in errorCollection)
{
bld.Append("\n Error Code: " + err.HResult.ToString("X"));
bld.Append("\n Message : " + err.Message);
bld.Append("\n Minor Err.: " + err.NativeError);
bld.Append("\n Source : " + err.Source);

foreach (int numPar in err.NumericErrorParameters)
{
if ( 0 != numPar ) bld.Append( "\n Num. Par. : " + numPar );
}

foreach ( string errPar in err.ErrorParameters )
{
if ( String.Empty != errPar ) bld.Append( "\n Err. Par. : " + errPar );
}

MessageBox.Show( bld.ToString(), "SQL Server CE Error" );
}
}

Once you have the specific error code, you can troubleshoot your replication.

http://msdn2.microsoft.com/en-us/library/ms171849(SQL.90).aspx.

-Darren

|||

Darren,

do you have coding for catch error in VBNet?

I've got An error has occured on the computer running IIS when I want to replicate my PDA to PC.. i'm using SQL Server 2000, VsNet 2003

|||

Here is the code in VB.NET:

Public Sub DisplaySQLCEErrors(ByVal ex As SqlCeException)

Dim errorCollection As SqlCeErrorCollection = ex.Errors
Dim bld As New StringBuilder()
Dim inner As Exception = ex.InnerException
Dim err As SqlCeError

For Each err In errorCollection

bld.Append(ControlChars.Lf + " Error Code: " + err.HResult.ToString())
bld.Append(ControlChars.Lf + " Message : " + err.Message)
bld.Append(ControlChars.Lf + " Minor Err.: " + err.NativeError.ToString())
bld.Append(ControlChars.Lf + " Source : " + err.Source)

Dim numPar As Integer
For Each numPar In err.NumericErrorParameters
If (numPar <> 0) Then
bld.Append(ControlChars.Lf + " Num. Par. : " + numPar.ToString())
End If
Next numPar
Dim errPar As String
For Each errPar In err.ErrorParameters
If (errPar <> String.Empty) Then
bld.Append(ControlChars.Lf + " Err. Par. : " + errPar)
End If
Next errPar

MessageBox.Show(bld.ToString(), "SQL Mobile Error")

Next err

End Sub

-Darren

|||

Thanks Darren,

But why I've got error at line

Dim bld As New StringBuilder -- Type 'StringBuilder' is not defined.

|||

:D I've to Imports System.Text..

THANKSSSS!!!

No comments:

Post a Comment