Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeGetting StartedGetting StartedInstalling DNN ...Installing DNN ...First Run Problems - EventQueue Issue ?First Run Problems - EventQueue Issue ?
Previous
 
Next
New Post
11/26/2006 2:42 PM
 
I have tried this basic approach on my hosting site and it seems to work. Note that I have also wrote a schedule to do the EventQueue stuff and set it to run every day.
 
New Post
11/27/2006 8:23 AM
 
Hi All,

I have created a version of DNN 4.3.6 that will work on in this situation. Please note the following

Basically I have created a version that does not do the EventQueue code has been removed from the App Start and I have created a schedule that will execute this code.

Below are more details on what I have changed

Global.asax.vb

In the Application_Start start method added the following to the top of the method
Code:

DotNetNuke.Common.ApplicationIdentity = System.Security.Principal.WindowsIdentity.GetCurrent()

Commented out the following lines at the end of the method these are the lines that course the issue)
Code:

Dim oEventController As New EventQueue.EventQueueController
oEventController.ProcessMessages("Application_Start")

In the DotNetNuke.Library in the Globals.vb file

Added the following private member
Code:

Private _ApplicationIdentity As System.Security.Principal.WindowsIdentity

Added the following Property
Code:

Public Property ApplicationIdentity() As System.Security.Principal.WindowsIdentity
Get
Return _ApplicationIdentity
End Get
Set(ByVal value As System.Security.Principal.WindowsIdentity)
_ApplicationIdentity = value
End Set
End Property

In the HttpModule.UrlRewrite module, within the UrlRewriteModule.vb file

Added the following to the OnBeginRequest method
Code:

' Check that the services are running under the current user
If DotNetNuke.Common.ApplicationIdentity.Name <> System.Security.Principal.WindowsIdentity.GetCurrent().Name Then
DotNetNuke.Common.ApplicationIdentity = System.Security.Principal.WindowsIdentity.GetCurrent()
End If



Within the Provider.DNNScheduler module, within the ProcessGroup.vb file

In the Run method change the following
Code:

Try
                    Process.ScheduleHistoryItem.Succeeded = False
                    Process.DoWork()
                Catch exc As Exception
                    'in case the scheduler client
                    'didn't have proper exception handling
                    'make sure we fire the Errored event
                    If Not Process Is Nothing Then
                        Process.ScheduleHistoryItem.Succeeded = False
                        Process.Errored(exc)
                    End If
                End Try

To this
Code:

Dim changedIdentity As Boolean = False
Dim wi As System.Security.Principal.WindowsImpersonationContext
Try
Process.ScheduleHistoryItem.Succeeded = False
If System.Security.Principal.WindowsIdentity.GetCurrent.Name <> Common.ApplicationIdentity.Name Then
wi = Common.ApplicationIdentity.Impersonate()
changedIdentity = True
End If
Process.DoWork()
If changedIdentity Then
wi.Undo()
End If
Catch exc As Exception
'in case the scheduler client
'didn't have proper exception handling
'make sure we fire the Errored event
If Not Process Is Nothing Then
Process.ScheduleHistoryItem.Succeeded = False
Process.Errored(exc)
End If
If changedIdentity Then
wi.Undo()
End If
End Try


Now for the standard Warrenty

There is no Warrenty with any of this code, I have ran and tested this on my hosting company. If you use it, it is at your risk please always test first. This alteration will make sure that the schedule provider runs the code as the correct user. Also by cometing out the code in the Application_Start it does not try to do the EventQueue stuff as the wrong user. However, this also means that the event queue code never runs at app start. I created a schedule to do this everyday.
 
New Post
11/27/2006 12:30 PM
 

Hi Tanzy,

I appreciate you taking the time to share how you resolved the problem.  There are a few issues that I see with this approach however. 
Using OnBeginRequest will make this check need to be done for every single request that comes through the system.  Using Init would be better.

I'll need to understand it better, but it looks like you will be forcing the use of impersonation which may not be desired for everyone.

Taking the code from the App_start for the EventQueue will keep the messages from being processed at the time of the Event.  I don't see the code to actually do the processing, but if you are running those same statements only daily then it changes it to be a batch process with a JobQueue.  Those messages need to be processed in an event-driven manner to be effective since they insure that final processing is completed after new modules are uploaded.  Although, if you are actually processing the messages, then that isn't the worst thing I guess.

 


DotNetNuke Modules from Snapsis.com
 
New Post
11/27/2006 1:24 PM
 
John Mitchell wrote

There are a few issues that I see with this approach however. 
Using OnBeginRequest will make this check need to be done for every single request that comes through the system.  Using Init would be better.

I tried using the Init however, at this point the it is still running under the AppPool user.

John Mitchell wrote

I'll need to understand it better, but it looks like you will be forcing the use of impersonation which may not be desired for everyone.

Yes I'm enforcing impercination, since I did not want to alter too much code. It should be possible to have an additinal setting within the schedule provider. This setting, could indicate what account you want it to run under. Maybe, the option of AppPool account, or Web Account.

[QUOTE]John Mitchell wrote

Taking the code from the App_start for the EventQueue will keep the messages from being processed at the time of the Event.  I don't see the code to actually do the processing,

[/Quote]

True, it does not run the EventQueue code. I have done this by adding a new schedule that I wrote.

[QUOTE]John Mitchell wrote

but if you are running those same statements only daily then it changes it to be a batch process with a JobQueue. 

[/Quote]

The reason I set it to run on a daily basis is that when I set it to run at AppStart. I knew that it would fail so I set it to retry after 5 minutes (thinking at this point the Website should be running under the correct account. However, when I was looking at the schedule history and when it was next ment to run, it keep increasing the time that is was suppose to run. Therefore, it never reattempted to execute the schedule

John Mitchell wrote

Those messages need to be processed in an event-driven manner to be effective since they insure that final processing is completed after new modules are uploaded.  Although, if you are actually processing the messages, then that isn't the worst thing I guess.

As mentioned, I wrote a schedule to execute the EventQueue code that should be ran in the AppStart. But as I said before, having it retry after 5 minutes was not working (i.e. it never ran). I'm not saying that this is the best solution. However, it works for the time being. Until the core team manage to figure out a better solution.

Ken

 
New Post
11/28/2006 10:30 AM
 

Thanks for responding Ken.  Your responses confirm why this is such a complex problem. 

I was afraid that Init would still be using the AppPool identity, and I understand the problem with the delay in starting the schedule.

The heart of the problem lies in that we are trying real hard to make a client-server type application using ASP.Net which has tried to turn a stateless protocol into one that has state, but still tries to gain everything that Http was invented for.  Couple that with the fact that many environments are configured a little different and we end up with a complex problem like this.

I'm glad you were able to solve the problem for you particular environment though.  Good work.


DotNetNuke Modules from Snapsis.com
 
Previous
 
Next
HomeHomeGetting StartedGetting StartedInstalling DNN ...Installing DNN ...First Run Problems - EventQueue Issue ?First Run Problems - EventQueue Issue ?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out