我首先要感谢我帮助我解决CLR触发器的早期问题,现在它已经部署并且我正在尝试开始测试,它会在插入或更新记录时抛出错误并终止。
Error:
Msg 6522, Level 16, State 1, Procedure WCFTrigger, Line 1
A .NET Framework error occurred during execution of user defined routine or aggregate 'WCFTrigger':
System.TypeInitializationException: The type initializer for 'Triggers' threw an exception. ---> System.Configuration.ConfigurationErrorsException: The type 'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.Behavior, Microsoft.VisualStudio.Diagnostics.ServiceModelSink, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' registered for extension 'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.Behavior' could not be loaded. (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config line 185)
System.Configuration.ConfigurationErrorsException:
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfi...
The statement has been terminated.
The trigger created in my table :
CREATE TRIGGER [WCFTrigger] ON [dbo].[tbCR] AFTER INSERT, UPDATE AS
EXTERNAL NAME [ServiceClient].[Triggers].[Trigger1]
GO
EXEC sys.sp_addextendedproperty @name=N'SqlAssemblyFile', @value=N'WCFTrigger.cs' ,@level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'tbCR', @level2type=N'TRIGGER', @level2name=N'WCFTrigger'
GO
EXEC sys.sp_addextendedproperty @name=N'SqlAssemblyFileLine', @value=N'55' ,@level0type=N'SCHEMA', @level0name=N'dbo', @level1type=N'TABLE', @level1name=N'tbCR', @level2type=N'TRIGGER', @level2name=N'WCFTrigger'
请有人告诉我这里缺少什么。在VS 2010上运行但目标框架工作是3.0。
先谢谢
答案 0 :(得分:0)
运行:C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\vsdiag_regwcf.exe -u
然后重新启动sql实例服务