Tuesday, March 27, 2012

DPE writing to Event Log

Has anyone had success getting a custom data processing extenstion to write
to the Event Log? Writing to the log works fine on my machine in the IDE but
once deployed to the server it fails. I'm assuming its a security issue but
I do not know how to resolve it.
Any help is greatly appreciated.Hi Shawn
Make sure that you've given the correct Code Access Security (CAS)
Permissions to your assembly. If you look up the EventLog.WriteEntry
method, it requires the EventLogPermission. To see how you can add
permission attributes to your custom assembly methods, see
http://msdn2.microsoft.com/en-us/library/ms153587.aspx.
Also, you may need to add extra security attributes to your
AssemblyInfo.cs/vb file. Please review the BOL for Reporting Services
or visit http://msdn2.microsoft.com/en-us/library/ms153561.aspx for
more details.
Regards,
Thiago Silva
MCAD.NET
Shawn wrote:
> Has anyone had success getting a custom data processing extenstion to write
> to the Event Log? Writing to the log works fine on my machine in the IDE but
> once deployed to the server it fails. I'm assuming its a security issue but
> I do not know how to resolve it.
> Any help is greatly appreciated.|||Thanks for the information. I have tried what was suggested and believe that
I am still missing something.
I added the following code group to my config file. As you can see it is
set to "FullTrust".
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="FOCUSCodeGroup"
Description="Code group for my data processing extension">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="D:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting
Services\ReportServer\bin\MyDataExtension.dll"/>
</CodeGroup>
I tried the following two approaches in my assembly:
1)--
EventLogPermission elp = new
EventLogPermission(System.Security.Permissions.PermissionState.Unrestricted);
elp.Assert();
elog.WriteEntry(loc + " -- " + msg, entryType);
2)--
EventLogPermission eventLogPermission = new
EventLogPermission(EventLogPermissionAccess.Administer, ".");
eventLogPermission.PermitOnly();
elog.WriteEntry(loc + " -- " + msg, entryType);
(#2 came from: http://support.microsoft.com/?kbid=918122)
During execution both prompted me for authentication when the exception was
thrown and never wrote to the event log. Any ideas as to what I could still
be missing?|||I was able to resolve the problem by first creating the EventSource on the
server itself. The problem was caused by the creation of the source... NOT
the writing to the log itself. Once the souce was create manually (in the
registry) I was able to write to the log successfully using the
configurations provided earlier. Thanks for the help.
http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/49c3188dba8b7b00/b7240a0183af6cd9?lnk=st&q=asp.net+2.0+eventlog+permission&rnum=10#b7240a0183af6cd9

No comments:

Post a Comment