2013-05-03 25 views
6

Chúng tôi gặp lỗi lạ trong môi trường Kiểm tra của chúng tôi với phần cấu hình tùy chỉnh."Đã xảy ra lỗi khi xử lý phần cấu hình cho" -

Đây là dịch vụ Windows chạy trên Enterprise Server 2008 r2 64 bit với SQL Server 2008 trong cả môi trường thử nghiệm và dev.

phần này cấu hình thư viện mã được chia sẻ của chúng tôi để gửi email ra bên quan tâm bất cứ khi nào một lỗi được xử lý và xuất bản với mã như thế này:

catch(Exception ex) 
{ 
    ExceptionManager.Publish(ex); 
} 

Các chi tiết cụ thể lỗi (đầy đủ chi tiết - tên thay đổi để bảo vệ người vô tội)

4 <configSections> 
5  <section name="exceptionManagement" 
6    type="Company.Shared.ExceptionManagement.ExceptionManagerSectionHandler, Company.Shared" /> 
7 </configSections> 
8 <exceptionManagement> 
9  <publisher assembly="Company.Shared" type="Company.Shared.ExceptionManagement.DefaultPublisher" 
10     logName="CPODSOracleDataExchange" applicationName="CPODSOracleDataExchange Service" /> 
11  <publisher assembly="Company.Shared" type="Company.Shared.ExceptionManagement.ExceptionManagerSMTPPublisher" 
12     from="[email protected]" 
13     defaultRecipients="[email protected],[email protected]" 
14     applicationName="CPODSOracleDataExchange Service" /> 
15 </exceptionManagement> 


1) Exception Information 
********************************************* 
Exception Type: System.Configuration.ConfigurationErrorsException 
Message: An error occurred creating the configuration section handler for exceptionManagement: Request failed. (E:\CITApps\Services\CPODS.OracleDataExchangeService\Company.CPODS.OracleDataExchangeService.exe.Config line 5) 
BareMessage: An error occurred creating the configuration section handler for exceptionManagement: Request failed. 
Filename: E:\CITApps\Services\CPODS.OracleDataExchangeService\Company.CPODS.OracleDataExchangeService.exe.Config 
Line: 5 
Errors: System.Configuration.ConfigurationException[] 
Data: System.Collections.ListDictionaryInternal 
TargetSite: System.Configuration.FactoryRecord FindAndEnsureFactoryRecord(System.String, Boolean ByRef) 
HelpLink: NULL 
Source: System.Configuration 

StackTrace Information 
********************************************* 
    at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) 
    at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) 
    at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) 
    at Company.Shared.ExceptionManagement.ExceptionManager.Publish(Exception exception, NameValueCollection additionalInfo) 

2) Exception Information 
********************************************* 
Exception Type: System.Security.SecurityException 
Action: Demand 
PermissionType: System.Security.PermissionSet 
FirstPermissionThatFailed: NULL 
PermissionState: <PermissionSet class="System.Security.PermissionSet" 
version="1" 
Unrestricted="true"/> 

Demanded: <PermissionSet class="System.Security.PermissionSet" 
version="1" 
Unrestricted="true"/> 

GrantedSet: 
RefusedSet: 
DenySetInstance: NULL 
PermitOnlySetInstance: <PermissionSet class="System.Security.PermissionSet" 
version="1"> 
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Access="Open"/> 
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Allowed="ApplicationIsolationByUser" 
UserQuota="1024000"/> 
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Flags="Execution"/> 
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
version="1" 
Window="SafeTopLevelWindows" 
Clipboard="OwnClipboard"/> 
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
version="1" 
Level="SafePrinting"/> 
<IPermission class="System.Security.Permissions.MediaPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
version="1" 
Audio="SafeAudio" 
Video="SafeVideo" 
Image="SafeImage"/> 
<IPermission class="System.Security.Permissions.WebBrowserPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
version="1" 
Level="Safe"/> 
</PermissionSet> 

FailedAssemblyInfo: NULL 
Method: Void InitWithRestrictedPermissions(System.Configuration.RuntimeConfigurationRecord, System.Configuration.FactoryRecord) 
Zone: NoZone 
Url: 
Message: Request failed. 
Data: System.Collections.ListDictionaryInternal 
TargetSite: System.Object CreateInstance(System.RuntimeType, Boolean, Boolean, Boolean ByRef, System.RuntimeMethodHandleInternal ByRef, Boolean ByRef) 
HelpLink: NULL 
Source: mscorlib 

StackTrace Information 
********************************************* 
    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) 
    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) 
    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) 
    at System.Activator.CreateInstance(Type type, Boolean nonPublic) 
    at System.Configuration.TypeUtil.CreateInstanceWithReflectionPermission(Type type) 
    at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) 
    at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) 
    at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord) 
    at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) 

phần tập tin cấu hình trong câu hỏi (với số dòng):

4 <configSections> 
5  <section name="exceptionManagement" 
6    type="Company.Shared.ExceptionManagement.ExceptionManagerSectionHandler, Company.Shared" /> 
7 </configSections> 
8 <exceptionManagement> 
9  <publisher assembly="Company.Shared" type="Company.Shared.ExceptionManagement.DefaultPublisher" 
10     logName="CPODSOracleDataExchange" applicationName="CPODSOracleDataExchange Service" /> 
11  <publisher assembly="Company.Shared" type="Company.Shared.ExceptionManagement.ExceptionManagerSMTPPublisher" 
12     from="[email protected]" 
13     defaultRecipients="[email protected],[email protected]" 
14     applicationName="CPODSOracleDataExchange Service" /> 
15 </exceptionManagement> 

Cấu hình chính xác này hoạt động tốt trong môi trường DEV của chúng tôi. Đây là những môi trường giống hệt với kiến ​​thức tốt nhất của tôi và cả hai dịch vụ đều chạy dưới cùng một cơ sở mã.

Bất kỳ ý tưởng nào về sự cố quyền truy cập là gì? Một điều chúng tôi đang làm là tạo nhật ký tùy chỉnh nhưng ngay cả khi chúng tôi xóa nhà xuất bản mặc định cố ghi vào nhật ký tùy chỉnh không tồn tại, quá trình vẫn không thành công.

+1

Bạn có thể tạo chương trình ngắn nhưng đầy đủ để minh họa sự cố (nếu chỉ trong môi trường thử nghiệm) không? –

+0

Bạn có nghĩa là bạn muốn xem mã kích hoạt lỗi không? –

+1

Ý tôi là chính xác những gì tôi nói - Tôi muốn một ví dụ ngắn nhưng đầy đủ mà chúng ta có thể thấy mọi phần, không thành công trong cùng một cách trên hệ thống kiểm tra của bạn. Bằng cách đó chúng ta có thể thấy mọi thứ mà * có thể * gây ra nó. –

Trả lời

4

Hóa ra đây là vấn đề cài đặt không rõ ràng.

Chúng tôi đã gỡ cài đặt dịch vụ bằng exe cũ và được cài đặt lại bằng khung 64 bit 4.0 và sự cố đã biến mất.

0

của nó thiết lập khuôn khổ trong cấu hình build

0

Không liên quan trực tiếp đến kịch bản của bạn, nhưng nếu bạn nhận được cùng một ngoại lệ trong khi cố gắng để chạy một ứng dụng .NET 4.0 từ một mạng chia sẻ, sau đó bạn cần phải cài đặt này hotfix: http://support.microsoft.com/kb/2580188