Hello Moshaikh,
I tried the piece of code you sent me. But it is not working meaning it is not logging anything when the page is running. Where is it supposed to log?
I am sure that I am doing something wrong. That's why I am providing my code below
----------------------------------------------------------------------------------------------------------------------------
Imports System.Diagnostics
Imports Microsoft.Web.Deployment
Imports System.Xml
Partial Class Deploy
Inherits System.Web.UI.Page
Dim strmode As String
Dim strSitename As String
Dim strSourceMetakey As String
Dim strSourceServer As String
Dim strDestMetaKey As String
Dim strDestServer As String
Dim strAppPoolName As String
Dim strArgs As String
Dim sourceAppPoolProvider As New DeploymentWellKnownProvider
Dim DestinationAppPoolProvider As New DeploymentWellKnownProvider
Dim sourceProvider As New DeploymentWellKnownProvider
Dim destinationProvider As New DeploymentWellKnownProvider
Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
Try
Dim sourceBaseOptions As New DeploymentBaseOptions()
AddHandler sourceBaseOptions.Trace, AddressOf TraceEventHandler
sourceBaseOptions.TraceLevel = TraceLevel.Info
Dim destinationBaseOptions As New DeploymentBaseOptions()
Dim destinationSyncOptions As New DeploymentSyncOptions()
destinationBaseOptions.ComputerName = strDestServer
Dim availableRules As DeploymentRuleCollection = DeploymentSyncOptions.GetAvailableRules()
For Each rule As DeploymentRule In availableRules
If rule.Name.Equals("DefaultDependencyCheck") Then
destinationSyncOptions.Rules.Remove("DefaultDependencyCheck")
End If
If rule.Name.Equals("default") Then
destinationSyncOptions.Rules.Remove("default")
End If
Next
For Each linkExtension As DeploymentLinkExtension In destinationBaseOptions.LinkExtensions
If (linkExtension.Name.Equals("AppPoolExtension", StringComparison.OrdinalIgnoreCase)) Then
linkExtension.Enabled = True
Exit For
End If
Next
If Trim(strAppPoolName) <> "" Then
sourceAppPoolProvider = DeploymentWellKnownProvider.AppPoolConfig
DestinationAppPoolProvider = DeploymentWellKnownProvider.AppPoolConfig
Using deploymentObject As DeploymentObject = DeploymentManager.CreateObject(sourceAppPoolProvider, strAppPoolName, sourceBaseOptions)
deploymentObject.SyncTo(DestinationAppPoolProvider, strAppPoolName, destinationBaseOptions, destinationSyncOptions)
End Using
End If
sourceProvider = DeploymentWellKnownProvider.MetaKey
destinationProvider = DeploymentWellKnownProvider.MetaKey
Using deploymentObject As DeploymentObject = DeploymentManager.CreateObject(sourceProvider, strSourceMetakey, sourceBaseOptions)
deploymentObject.SyncTo(destinationProvider, strSourceMetakey, destinationBaseOptions, destinationSyncOptions)
End Using
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
Protected Sub TraceEventHandler(ByVal sender As Object, ByVal traceEvent As DeploymentTraceEventArgs)
WriteEvent(traceEvent)
End Sub
Protected Sub WriteEvent(ByVal e As DeploymentTraceEventArgs)
Dim traceLevel As TraceLevel = e.EventLevel
Response.Write(e.Message)
'Console.WriteLine(e.Message)
End Sub
---------------------------------------------------------------------------------------------------------------------
Can you please check this out and let me know what I am doing wrong here?
Appreciate your taking time to help me out...
Thanks a bunch!!!