Re: permissions to call a webservice

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:UlNz0m06GHA.1864@xxxxxxxxxxxxxxxxxxxxxxxx
Hello Trapulo,

Nice to see you again. How are you doing?

Hello Steven :)
All right, thanks. I have always some trouble for you, but at least my works
go on every day a little :)

From your description here, your .net 2.0 program will access a remote
webservice and write some logs. However, you found that it will always
fail
when running under a non-administrator account, correct?

Yes.

As for the .net application, it is hard to directly determine what exact
permission is necessary or on which resource the secruity issue occured.
Would you provide some detailed information on how does it access the
webservice and how does it write the log, is the log windows system log or
your custom log file?

I can provide you the entire program, because it is really very simple:

Sub Main()
Try

Dim startupTimeStamp As DateTime = Now

My.Application.Log.WriteEntry(startupTimeStamp.ToString & "-Starting",
TraceEventType.Information)

Console.WriteLine("Starting...")

Dim service As New massSenderService.ScheduledCalls

Dim isProcessing As Boolean

Do

isProcessing = service.CheckDeliveryRequired()

My.Application.Log.WriteEntry(Now.ToString & "-IsProcessing=" &
isProcessing, TraceEventType.Information)

If isProcessing Then

Threading.Thread.Sleep(TimeSpan.FromSeconds(30))

Console.WriteLine("Server is processing... going to wait")

End If

Loop Until isProcessing = False OrElse
Now.Subtract(startupTimeStamp).TotalMinutes > 90

Console.WriteLine("Exiting")

My.Application.Log.WriteEntry(Now.ToString & "-Exiting with isprocessing=" &
isProcessing, TraceEventType.Information)

Catch ex As Exception

My.Application.Log.WriteEntry(Now.ToString & "-Unexpected error: " &
ex.Message, TraceEventType.Critical)

End Try

End Sub

Basically, it calls a webservice (massSenderService.ScheduledCall) and waits
for a signal from the service itself. It makes a call every 30 seconds until
remote service has finished, and writes some trace to my.application.log.
The listener is configured to write to a file.

<sharedListeners>

<add name="FileLog"

type="Microsoft.VisualBasic.Logging.FileLogTraceListener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"

initializeData="FileLogWriter" location="ExecutableDirectory"
BaseFileName="TraceLog" LogFileCreationSchedule="Weekly"
MaxFileSize="1048576"/>

</sharedListeners>

Currently, I suggest you try isolate the problem to
see whether the error is caused by the webservice call or the log writing.

I think it's not a NTFS permission, because the entire folder has write
permissions. Maybe the "my.application.log" implementation requires some
strange permission set?

Also, is the problem occuring if you do not use schedule task to run your
program(under the same non-admin user)?

mmm.. I may try this on some development envirnoment, because I've installed
the program on a remote (production) server, and I cannot access it only via
termina services, so I need to be an adminstrator.. :( I'll try.



thank you



.