Context :
Windows 2019 Server
ASP.NET MVC using .NET Framework 4.5.2
log4net 2.0.12
In web.config (inside <configSections>) I have:
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
In the same file (inside <configuration>)
<log4net debug="true">
<root>
<level value="ALL" />
</root>
<logger name="inboundAPI">
<level value="ALL" />
<appender-ref ref="RollingFileAppender" />
</logger>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\temp\inboundAPI.log" />
<appendToFile value="true" />
<preserveLogFileNameExtension value="true"/>
<rollingStyle value="Date"/>
<datePattern value=".yyyyMMdd"/>
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level - %message%newline" />
</layout>
</appender>
</log4net>
Finally inside Global.asax.vb I have:
Sub Application_Start()
...
log4net.Config.XmlConfigurator.Configure()
End Sub
The directory (C:\temp\) where the log is supposed to be is Full Access for Everyone.
C:\>cacls C:\temp
C:\temp Everyone:(OI)(CI)F
BUILTIN\IIS_IUSRS:(OI)(CI)F
NT AUTHORITY\SYSTEM:(OI)(CI)(ID)F
BUILTIN\Administrators:(OI)(CI)(ID)F
BUILTIN\Users:(OI)(CI)(ID)R
BUILTIN\Users:(CI)(ID)(special access:)
FILE_APPEND_DATA
BUILTIN\Users:(CI)(ID)(special access:)
FILE_WRITE_DATA
CREATOR OWNER:(OI)(CI)(IO)(ID)F
The file is created and inherits the proper rights but remain empty while it is not empty on my development PC, using IIS Express.
C:\temp>dir
Volume in drive C is Windows
Volume Serial Number is 3A59-32AE
Directory of C:\temp
06/23/2021 07:18 PM <DIR> .
06/23/2021 07:18 PM <DIR> ..
06/23/2021 07:18 PM 0 inboundAPI.log
06/23/2021 07:41 PM 5,382 log4net.txt
2 File(s) 5,382 bytes
2 Dir(s) 15,342,981,120 bytes free
C:\temp>cacls inboundAPI.log
C:\temp\inboundAPI.log Everyone:(ID)F
BUILTIN\IIS_IUSRS:(ID)F
NT AUTHORITY\SYSTEM:(ID)F
BUILTIN\Administrators:(ID)F
BUILTIN\Users:(ID)R
IIS APPPOOL\InboundAPI:(ID)F
I have a system.diagnotic section in the same web.config file:
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add
name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\temp\log4net.txt" />
</listeners>
</trace>
</system.diagnostics>
That is writing to the same directory successfully and here is the content as it might help
log4net: log4net assembly [log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a]. Loaded from [C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\inboundapi\7b262cab\40e772b2\assembly\dl3\b60f6c7c\739e9dfa_715cd701\log4net.dll]. (.NET Runtime [4.0.30319.42000] on Microsoft Windows NT 10.0.17763.0)
log4net: defaultRepositoryType [log4net.Repository.Hierarchy.Hierarchy]
log4net: Creating repository for assembly [InboundAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]
log4net: Assembly [InboundAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] Loaded From [C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\inboundapi\7b262cab\40e772b2\assembly\dl3\df6af0be\ce6bcea0_5268d701\InboundAPI.dll]
log4net: Assembly [InboundAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] does not have a RepositoryAttribute specified.
log4net: Assembly [InboundAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] using repository [log4net-default-repository] and repository type [log4net.Repository.Hierarchy.Hierarchy]
log4net: Creating repository [log4net-default-repository] using type [log4net.Repository.Hierarchy.Hierarchy]
log4net: configuring repository [log4net-default-repository] using .config file section
log4net: Application config file is [C:\inetpub\wwwroot\InboundAPI\web.config]
log4net: Configuring Repository [log4net-default-repository]
log4net: Configuration update mode [Merge].
log4net: Logger [root] Level string is [ALL].
log4net: Logger [root] level set to [name="ALL",value=-2147483648].
log4net: Retrieving an instance of log4net.Repository.Logger for logger [inboundAPI].
log4net: Setting [inboundAPI] additivity to [True].
log4net: Logger [inboundAPI] Level string is [ALL].
log4net: Logger [inboundAPI] level set to [name="ALL",value=-2147483648].
log4net: Loading Appender [RollingFileAppender] type: [log4net.Appender.RollingFileAppender]
log4net: Setting Property [File] to String value [C:\temp\inboundAPI.log]
log4net: Setting Property [AppendToFile] to Boolean value [True]
log4net: Setting Property [PreserveLogFileNameExtension] to Boolean value [True]
log4net: Setting Property [RollingStyle] to RollingMode value [Date]
log4net: Setting Property [DatePattern] to String value [.yyyyMMdd]
log4net: Setting Property [StaticLogFileName] to Boolean value [True]
log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Setting Property [ConversionPattern] to String value [%date [%thread] %-5level - %message%newline]
log4net: Converter [date] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [ [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [thread] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [] ] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [level] Option [] Format [min=5,max=2147483647,leftAlign=True]
log4net: Converter [literal] Option [ - ] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Setting Property [Layout] to object [log4net.Layout.PatternLayout]
log4net: Type = [0], r0 = [.19700101], r1 = [.19700101]
log4net: Type = [1], r0 = [.19700101], r1 = [.19700101]
log4net: Type = [2], r0 = [.19700101], r1 = [.19700101]
log4net: Type = [3], r0 = [.19700101], r1 = [.19700102]
log4net: Searched for existing files in [C:\temp]
log4net: curSizeRollBackups starts at [0]
log4net: Opening file for writing [C:\temp\inboundAPI.log] append [True]
log4net: Created Appender [RollingFileAppender]
log4net: Adding appender named [RollingFileAppender] to logger [inboundAPI].
log4net: Hierarchy Threshold []
I think that I've read dozens of posts here and there and it might look like a duplicate but I swear that I tried all of what I read.
I still don't understand the following:
(1) Why is everything working on my PC with IIS Express?
(2) Why is the file created to suggest that rights are correct but remains empty?
(3) Why is the same IIS able to fill the log4net diagnostic in the same directory?
(4) Why is that diagnostic is not showing any error?
(5) Why is there nothing in the event log of Windows?
My brain is exploding!
Related
I encountered issue using NLog when I want to render asp.net related info into my database. Here is the internal logging for NLog.
2017-07-16 03:08:06.5485 Debug ScanAssembly('NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=')
2017-07-16 03:08:06.5796 Debug Start auto loading, location:
2017-07-16 03:08:06.5796 Debug Auto loading done
2017-07-16 03:08:06.6036 Error Error parsing layout aspnet-request-method will be ignored. Exception: System.ArgumentException: LayoutRenderer cannot be found: 'aspnet-request-method'. Is NLog.Web not included?
at NLog.Config.Factory`2.CreateInstance(String name)
at NLog.Layouts.LayoutParser.ParseLayoutRenderer(ConfigurationItemFactory configurationItemFactory, SimpleStringReader sr)
2017-07-16 03:08:06.6115 Error Error parsing layout aspnet-request-method will be ignored. Exception: System.ArgumentException: LayoutRenderer cannot be found: 'aspnet-request-method'. Is NLog.Web not included?
at NLog.Config.Factory`2.CreateInstance(String name)
at NLog.Layouts.LayoutParser.ParseLayoutRenderer(ConfigurationItemFactory configurationItemFactory, SimpleStringReader sr)
2017-07-16 03:08:06.6115 Debug --- NLog configuration dump ---
2017-07-16 03:08:06.6115 Debug Targets:
2017-07-16 03:08:06.6276 Debug Rules:
2017-07-16 03:08:06.6276 Debug logNamePattern: (:All) levels: [ Debug Info Warn Error Fatal ] appendTo: [ ]
2017-07-16 03:08:06.6276 Debug logNamePattern: (:All) levels: [ Debug Info Warn Error Fatal ] appendTo: [ ]
2017-07-16 03:08:06.6276 Debug --- End of NLog configuration dump ---
2017-07-16 03:08:06.6456 Info Found 24 configuration items
2017-07-16 03:08:06.6966 Info Found 24 configuration items
2017-07-16 03:08:06.7085 Debug Targets for LicenseServer.Utility.Log by level:
2017-07-16 03:08:06.7085 Debug Trace =>
2017-07-16 03:08:06.7085 Debug Debug =>
2017-07-16 03:08:06.7225 Debug Info =>
2017-07-16 03:08:06.7225 Debug Warn =>
2017-07-16 03:08:06.7225 Debug Error =>
2017-07-16 03:08:06.7225 Debug Fatal =>
I am avoiding doing configuration on xml file. so I took programmatic configuration approach. which is working fine totally except it is giving issue when I put 'aspnet-request-method' and any other aspnet related layouts. I installed NLog.Web and NLog.Extend but it is still not working. below is my code on setting up configuration :
public static class Log
{
public static Logger _logger { get; set; }
public static void Init()
{
InternalLogger.LogFile = #"D:\Nlog.txt";
InternalLogger.LogLevel = LogLevel.Debug;
var config = new LoggingConfiguration();
var db_target = new DatabaseTarget();
db_target.DBProvider = #"MySql.Data.MySqlClient.MySqlConnection, MySql.Data";
db_target.ConnectionString =
$#"server={DBConfig._server};database={DBConfig._dbname};userid={DBConfig._username};password={DBConfig
._password};";
db_target.DBHost = DBConfig._server;
db_target.DBDatabase = DBConfig._dbname;
db_target.DBUserName = DBConfig._username;
db_target.DBDatabase = DBConfig._password;
db_target.CommandText = #"INSERT INTO error_log(system, module, action, content) VALUES(#activityid, #request, #logger, #ip)";
db_target.Parameters.Add(new DatabaseParameterInfo("#activityid", new NLog.Layouts.SimpleLayout("${activityid}")));
db_target.Parameters.Add(new DatabaseParameterInfo("#request", new NLog.Layouts.SimpleLayout(#"${aspnet-request-method}")));
db_target.Parameters.Add(new DatabaseParameterInfo("#logger", new NLog.Layouts.SimpleLayout("${logger}")));
db_target.Parameters.Add(new DatabaseParameterInfo("#ip", new NLog.Layouts.SimpleLayout("${aspnet-request-method}")));
db_target.KeepConnection = true;
var rule = new LoggingRule("*", LogLevel.Debug, db_target);
config.LoggingRules.Add(rule);
config.LoggingRules.Add(rule);
LogManager.Configuration = config;
_logger = LogManager.GetCurrentClassLogger();
}
}
Please note, you need to install NLog.Web (ASP.NET non-core) or NLog.Web.AspNetCore and for ASP.NET Core you need in your nlog.config
<!-- enable asp.net core layout renderers -->
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
I have created ASP.NET Core project from command line:
> dotnet new web
> dotnet restore
> dotnet build
> dotnet run
All works fine.
Now I have opened this project in Visual Studio 2017.
Debug - Start without debugging:
Unhandled Exception: System.IO.FileNotFoundException: Could not load
file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified. at
System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken,
IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs,
Int32 methodInstCount, ObjectHandleOnStack type) at
System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module,
Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext,
RuntimeTypeHandle[] methodInstantiationContext) at
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken,
Type[] genericTypeArguments, Type[] genericMethodArguments) at
System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord
caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly,
RuntimeModule decoratedModule, MetadataToken decoratedToken,
RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[]
attributes, IList derivedAttributes, RuntimeType& attributeType,
IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean&
isVarArg) at
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule
decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount,
RuntimeType attributeFilterType, Boolean mustBeInheritable, IList
derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) at
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly
assembly, RuntimeType caType) at
System.Attribute.GetCustomAttributes(Assembly element, Type
attributeType, Boolean inherit) at
System.AppDomain.GetTargetFrameworkName()
How can I launcn, debug and develop my project in VS ?
p.s. I know I can create new project in VS and it works fine, but I need to work with project which was created from command line.
Update:
PS Q:\tsts> dotnet --version
1.0.0
PS Q:\tsts> type .\tsts.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
</ItemGroup>
</Project>
PS Q:\tsts> dotnet build
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
tsts -> Q:\tsts\bin\Debug\netcoreapp1.1\tsts.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.90
Opening and running dotnet new project in VS2017 should work.
But sometimes VS goes crazy with strange and inexplicable "not found" dependencies and "not compiled" new files - then just close VS (or unload project), manually remove bin and obj folders and reopen project.
i have a .net app that was in .net 3.0 and using crystal reports 10.5
we migrated to .net 4.5 and a new development/testing web server using .net 4.5
now the application will not load.
the errors that i receive are:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 16: <compilation debug="true" targetFramework="4.5">
Line 17: <assemblies>
Line 18: <add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
Line 19: <add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
Line 20: <add assembly="CrystalDecisions.ReportSource, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
Source File: E:\IIS_Sites\NOSSA\WebSAR\3.8.1\web.config Line: 18
Assembly Load Trace: The following information can be helpful to determine why the assembly 'CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be loaded.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
(Fully-specified)
LOG: Appbase = file:///C:/inetpub/wwwroot/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\bin
Calling assembly : (Unknown).
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\inetpub\wwwroot\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
i have installed the crystal runtime.
i'm not sure what else to try.
thanks
Are the following files in the bin directory of your website/application?
crystaldecisions.crystalreports.engine.dll, crystaldecisions.reportsource.dll, crystaldecisions.shared.dll, crystaldecisions.web.dll.
Also, I believe that version of CR is compiled under .NET 2.0 so you may need to enable the legacyV2 runtime. You can do so via the app.config file by adding useLegacyV2RuntimeActivationPolicy="true" to the startup element.
Or, you can do it in code by using the RuntimePolicyHelper class.
eg.
Imports System.Runtime.InteropServices
Imports System.Runtime.CompilerServices
'instantiate your class
Public Sub New()
Try
'runtime support for mixed mode assemblies
'this is used to load .NET 2.0 assemblies that crystal reports is built against.
If RuntimePolicyHelper.LegacyV2RuntimeEnabledSuccessfully = True Then
Else
If MsgBox("Legacy CLR could not be loaded. Continue?", _
vbYesNo + vbExclamation, _
"Failed to load legacy runtime.") = vbNo Then
Application.Exit()
End If
End If
Catch ex As Exception
ex = New Exception(ex.Message & vbCrLf & ex.StackTrace)
Throw ex
End Try
End Sub
Public NotInheritable Class RuntimePolicyHelper
Private Sub New()
End Sub
Public Shared Property LegacyV2RuntimeEnabledSuccessfully() As Boolean
Get
Return m_LegacyV2RuntimeEnabledSuccessfully
End Get
Private Set(value As Boolean)
m_LegacyV2RuntimeEnabledSuccessfully = value
End Set
End Property
Private Shared m_LegacyV2RuntimeEnabledSuccessfully As Boolean
Shared Sub New()
Try
Dim clrRuntimeInfo As ICLRRuntimeInfo = _
DirectCast(RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, _
GetType(ICLRRuntimeInfo).GUID), ICLRRuntimeInfo)
Try
clrRuntimeInfo.BindAsLegacyV2Runtime()
LegacyV2RuntimeEnabledSuccessfully = True
Catch generatedExceptionName As COMException
LegacyV2RuntimeEnabledSuccessfully = False
End Try
Catch ex As Exception
ex = New Exception(ex.Message & vbCrLf & ex.StackTrace)
Throw ex
End Try
End Sub
<ComImport()> _
<InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
<Guid("xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx")> _
Private Interface ICLRRuntimeInfo
Sub xGetVersionString()
Sub xGetRuntimeDirectory()
Sub xIsLoaded()
Sub xIsLoadable()
Sub xLoadErrorString()
Sub xLoadLibrary()
Sub xGetProcAddress()
Sub xGetInterface()
Sub xSetDefaultStartupFlags()
Sub xGetDefaultStartupFlags()
<MethodImpl(MethodImplOptions.InternalCall, _
MethodCodeType:=MethodCodeType.Runtime)> _
Sub BindAsLegacyV2Runtime()
End Interface
End Class
Please note that I didn't come up with this code - I may have even found it on this site - but I can't find the original contributor. However, it works for me so you may want to give it a try.
I recently installed the latest PowerTools on Tridion 2011 SP1. After installing my CM gives the following error.
Uncaught ReferenceError: Tridion is not defined
Attaching a screenshot of the error below
If now I remove the PowerTools, I get an following error.
System.IO.FileNotFoundException: Could not load file or assembly 'Interop.TDSI18NLib, Version=5.4.0.0, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b' or one of its dependencies. The system cannot find the file specified. File name: 'Interop.TDSI18NLib, Version=5.4.0.0, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b' at Tridion.Web.UI.Models.TCM54.LocalizationModule.InitializeCulture(Object sender, EventArgs args) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Windows\SysWOW64\inetsrv\w3wp.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = NT AUTHORITY\NETWORK SERVICE LOG: DisplayName = Interop.TDSI18NLib, Version=5.4.0.0, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b (Fully-specified) LOG: Appbase = file:///C:/Program Files (x86)/Tridion/web/WebUI/WebRoot/ LOG: Initial PrivatePath = C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\bin Calling assembly : Tridion.Web.UI.Models.TCM54, Version=6.1.0.55920, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: Interop.TDSI18NLib, Version=5.4.0.0, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/webui/f9209e65/566ab287/Interop.TDSI18NLib.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/webui/f9209e65/566ab287/Interop.TDSI18NLib/Interop.TDSI18NLib.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Tridion/web/WebUI/WebRoot/bin/Interop.TDSI18NLib.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Tridion/web/WebUI/WebRoot/bin/Interop.TDSI18NLib/Interop.TDSI18NLib.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/webui/f9209e65/566ab287/Interop.TDSI18NLib.EXE. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/webui/f9209e65/566ab287/Interop.TDSI18NLib/Interop.TDSI18NLib.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Tridion/web/WebUI/WebRoot/bin/Interop.TDSI18NLib.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Tridion/web/WebUI/WebRoot/bin/Interop.TDSI18NLib/Interop.TDSI18NLib.EXE.
Updated - Screenshot of the Error
The error from HTML as suggested by Frank.
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Tridion.ContentManager.CoreService.Client, Version=6.1.0.996, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b' or one of its dependencies. The system cannot find the file specified.
File name: 'Tridion.ContentManager.CoreService.Client, Version=6.1.0.996, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b'
at System.Signature.GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Signature..ctor(IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
at System.Reflection.RuntimeMethodInfo.GetParameters()
at System.ServiceModel.Description.ServiceReflector.ValidateParameterMetadata(MethodInfo methodInfo)
at System.ServiceModel.Description.TypeLoader.CreateOperationDescriptions(ContractDescription contractDescription, ContractReflectionInfo reflectionInfo, Type contractToGetMethodsFrom, ContractDescription declaringContract, MessageDirection direction)
at System.ServiceModel.Description.TypeLoader.CreateContractDescription(ServiceContractAttribute contractAttr, Type contractType, Type serviceType, ContractReflectionInfo& reflectionInfo, Object serviceImplementation)
at System.ServiceModel.Description.TypeLoader.LoadContractDescriptionHelper(Type contractType, Type serviceType, Object serviceImplementation)
at System.ServiceModel.Description.ContractDescription.GetContract(Type contractType)
at System.Web.Script.Services.WCFServiceClientProxyGenerator.GetClientProxyScript(Type contractType, String path, Boolean debugMode, ServiceEndpoint serviceEndpoint)
at System.Web.Script.Services.ProxyGenerator.GetClientProxyScript(Type type, String path, Boolean debug, ServiceEndpoint serviceEndpoint)
at Tridion.Web.UI.Core.CachedJsService.get_Contents()
at Tridion.Web.UI.Core.CachedJsService.WriteContents(HttpResponse response, List`1 writtenResources)
at Tridion.Web.UI.Core.CachedJsGroup.WriteContents(HttpResponse response, List`1 writtenResources)
at Tridion.Web.UI.Core.CachedJsPageResources.WriteContents(HttpResponse response, List`1 writtenResources)
at Tridion.Web.UI.Core.CachedJsControlResources.WriteContents(HttpResponse response)
at Tridion.Web.UI.Core.Common.HttpUtilities.OutputWithHTTPCacheHeaders(ICachedResource resource, Nullable`1 cacheDuration)
at Tridion.Web.UI.Controls.TridionPage.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Windows\SysWOW64\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = Tridion.ContentManager.CoreService.Client, Version=6.1.0.996, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Tridion/web/WebUI/WebRoot/
LOG: Initial PrivatePath = C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\bin
Calling assembly : Tridion.UGC.Model, Version=6.1.0.205, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Tridion.ContentManager.CoreService.Client, Version=6.1.0.996, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.DashboardView.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
The power tools are an open source project, and the issue tracker is available at:
http://code.google.com/p/tridion-2011-power-tools/issues
If you believe you have discovered a bug (or perhaps two), you can help the project team by reporting the problems there. (For bonus points - download the sources and work on a fix!)
I am getting this error:
------ Test started: Assembly: ECEHire.Test.dll ------
Test 'ECEHire.Test.Tests.GenerateSchema_Fixture.Can_generate_schema' failed: NHibernate.HibernateException : Format of the initialization string does not conform to specification starting at index 49.
----> System.ArgumentException : Format of the initialization string does not conform to specification starting at index 49.
at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action1 scriptAction, Boolean export, Boolean justDrop)
at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script, Boolean export, Boolean justDrop)
GenerateSchema_Fixture.vb(18,0): at ECEHire.Test.Tests.GenerateSchema_Fixture.Can_generate_schema()
--ArgumentException
at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)
at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)
at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)
at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
at System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value)
at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
at NHibernate.Connection.DriverConnectionProvider.GetConnection()
at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action1 scriptAction, Boolean export, Boolean justDrop)
0 passed, 1 failed, 0 skipped, took 3.23 seconds (NUnit 2.5.10).
When I try to test my NHibernate configuration file.
The configuration file is:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.connection_string">Data Source=MyServerName;initial catalog=MyDatabaseName;Integrated Security=SSPI</property>
<property name="connection.isolation">ReadCommitted</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
</hibernate-configuration>
The test that I am running is:
<Test()> _
Public Sub Can_generate_schema()
Dim cfg = New Configuration()
cfg.Configure()
cfg.AddAssembly(GetType(Question).Assembly)
Dim exp As NHibernate.Tool.hbm2ddl.SchemaExport = New NHibernate.Tool.hbm2ddl.SchemaExport(cfg)
exp.Execute(False, True, False)
End Sub
I believe that this is a connection string error, but the connection string works as part of the web.config file for querying the database via ADO.
A few things to try:-
Could it be something as simple as adding a ; (semi colon) e.g. Integrated Security=SSPI;
Or try changing to Integrated Security=True;
Or drop connection.connection_string and use connection.connection_string_name
In web.config
<connectionStrings>
<add name="db" connectionString="Data Source=MyServerName;initial catalog=MyDatabaseName;Integrated Security=SSPI;"/>
</connectionStrings>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
...
<property name="connection.connection_string_name">db</property>
...
</session-factory>
</hibernate-configuration>
Edit The next thing to try is to make sure that the configuration file is being used in your test so try this:-
cfg.Configure(#"c:\hibernate.cfg.xml");
Making sure that the path IS totally correct, If this fails then put a break point at this line:-
cfg.AddAssembly(GetType(Question).Assembly)
and then add this watch cfg.Properties and make sure that the connection string is present as a key value pair
Edit2
For unit testing you would need to copy local true and get path from executing assembly OR create an app.config and use:-
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property ../>
</session-factory>
</hibernate-configuration>
</configuration>
For a web site you could do:-
cfg.Configure(HttpContext.Current.Server.MapPath("~/hibernate.cfg.xml"));
To be honest there are lots of options and this is really another question!