Quantcast
Channel: patterns & practices – Enterprise Library
Viewing all 1928 articles
Browse latest View live

New Post: Enterprise Library 6.0 Installation

$
0
0
I am lost and got into the same situation.
So, what's next after running the powershell script?
Do I have to register the downloaded dlls to GAC manually?
Or, am I expected to use NUGET to re-download the dlls whenever I need it in any of my new or existing projects?

Thanks.

New Post: Enterprise Library 6.0 Installation

$
0
0
Thanks for downloading Enterprise Library 6 and thanks for your feedback.

If you wish to deploy to the GAC then you would just run gacutil or drag and drop the applicable assemblies into the GAC. Enterprise Library 5 actually didn't deploy assemblies to the GAC by default when running the installer. Perhaps you mean having the assemblies appear in the Add Reference Dialog?

I wrote up a walk-through which should hopefully answer some questions and give some options, Enterprise Library 6: Installation and VS2012 Configuration.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

New Post: Enterprise Library 6.0 Installation

New Post: ENTLIB6 Code samples

New Post: How to use static logger??? Logging Application Block

$
0
0
This is a question pertaining to version 6 and static logger.

In version 5.0, it's possible to just call Logger.Write(logEntry); where logEntry is a LogEntry object appropriately set. All configuration is done declaratively.

When attempting that with 6.0 an error is generated and it's not clear what to do.

The error is: The LogWriter has not been set for the Logger static class. Set it invoking the Logger.SetLogWriter method.


Logger.SetLogWriter() lo;ks to require an instantiated object.

Using Logger.SetLogWriter(Logger.Writer) doesn't work.

How can the static logger be used with entlib 6.0?

New Post: How to use static logger??? Logging Application Block

$
0
0
The boostrapping behavior of Enterprise Library has changed in Version 6. The impact for the static Logger facade is that you need to set the internal LogWriter (for example at application start):
Logger.SetLogWriter(new LogWriterFactory().Create());
Logger.Write("test", "General");
~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

Updated Wiki: EntLib6

$
0
0

Updated Wiki: EntLib6

$
0
0

Released: Enterprise Library 6 - April 2013 (Apr 25, 2013)

$
0
0
Microsoft Enterprise Library 6 official binaries can be downloaded via NuGet (recommended) and fromMicrosoft Download Center.

Additional resources related to this release are provided here.

Note: When downloading a CHM file, remember to Unblock it (Right Click and then look under Security) as it may be blocked by the OS.

See also EntLib6 page on Codeplex.

Updated Release: Enterprise Library 6 - April 2013 (Apr 25, 2013)

$
0
0
Microsoft Enterprise Library 6 official binaries can be downloaded via NuGet (recommended) and from Microsoft Download Center.

Additional resources related to this release are provided here.

Note: When downloading a CHM file, remember to Unblock it (Right Click and then look under Security) as it may be blocked by the OS.

See also EntLib6 page on Codeplex.

Updated Wiki: EntLib6

$
0
0

New Post: ENTLIB6 Code samples

New Post: How to use static logger??? Logging Application Block

$
0
0
Thanks that worked ... with some additional modification as described below.

There is one other issue, perhaps it's best put into a new question, but here it is ...

In our solution we have many projects/services using the logging application block and thus use redirection in the app.config files so we can have a single application configuration for the logging block. This is because when the application is running, there are numerous app.config files that will be in use at once (numerous processes).

Thus these are the specific settings as found in the app.config, which redirects to the main config (entlib.config) for enterprise library config settings:

<configSections>
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
<enterpriseLibrary.ConfigurationSource selectedSource="System Configuration Source">
<sources>
  <add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  <add name="File-based Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" filePath="C:\Pathtotheconfig\EntLib.config" />
</sources>
<redirectSections>
  <add sourceName="File-based Configuration Source" name="loggingConfiguration" />
  <add sourceName="File-based Configuration Source" name="exceptionHandling" />
</redirectSections>
</enterpriseLibrary.ConfigurationSource>

When the above (Logger.SetLogWriter(new LogWriterFactory().Create());) executes, the following exception is thrown:

System.InvalidOperationException was caught
HResult=-2146233079
Message=The configuration section for Logging cannot be found in the configuration source.
Source=Microsoft.Practices.EnterpriseLibrary.Logging
StackTrace:
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterFactory.LogWriterConfigurationBuilder.Create()
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterFactory.Create()
   at ...appspecificinfo...
InnerException:

To get around this, it's necessary to stop redirecting and put the config settings into each app.config file. I did modify the Version from 5.0.505.0 to 6.0.0.0 in the redirect settings as well as the entlib.config settings when generating the exception.

So the question is, "Does config file redirection still work with entlib 6?" If so, what's needed to be changed to make it work (using the above settings as the baseline whi8ch provides logging and exception handling settings redirect to a single source for these settings)?

New Post: How to use static logger??? Logging Application Block

$
0
0
It looks like new LogWriterFactory() will default to use System.Configuration directly to attempt to get the config section.

One way to ensure that you hook into the Enterprise Library configuration is to use ConfigurationSourceFactory:
IConfigurationSource configurationSource = ConfigurationSourceFactory.Create();
LogWriterFactory logWriterFactory = new LogWriterFactory(configurationSource);
Logger.SetLogWriter(logWriterFactory.Create());
            
Logger.Write("test", "General");
~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

Updated Wiki: EntLib6ReleaseNotes

$
0
0

Microsoft Enterprise Library 6 – Final Release

Release Notes

Updated 4/25/2013

Welcome to the final release of Microsoft Enterprise Library 6!
This document contains a brief summary of Microsoft Enterprise Library 6, including late-breaking information that is not included in the main documentation. Additional information and bug fixes delivered after release are available on the Enterprise Library Community site and on the Enterprise Library MSDN site.

Where to get it?

Via NuGet – use the NuGet Package Manager in Visual Studio and search online for the “enterpriselibrary” packages. Pick the official Microsoft packages.

What’s New in this Release?

This major release of Enterprise Library contains many compelling new features and updates that will make developers more productive. These include:
  • Major changes throughout Enterprise Library to make it simpler and easier to learn and use whilst minimizing the impact of these changes for existing users.
  • A new Semantic Logging Application Block to make it easier to adopt semantic/structured logging in your applications.
  • The addition of the Transient Fault Handling Block as a full member of the library to help you make your on-premises and Windows Azure based applications more resilient to transient errors.
  • Several enhancements to Unity type registration to help you streamline the registration of types in the Unity container.
  • Support for Windows Store apps.
  • Simpler programmatic configuration for all the blocks.
  • Deeper integration with other technologies such as ASP.NET MVC and WebApi.

The detailed change log is included in the Enterprise Library documentation and also at the end of this document.

Installing with Previous Versions of Enterprise Library

You cannot install Enterprise Library 6 side-by-side with a previous version of the library in the same Visual Studio project.

System requirements

  • Supported architectures: x86 and x64.
  • Operating systems: Microsoft Windows® 8, Microsoft Windows® 7, Windows Server 2008 R2, Windows Server 2012.
  • Supported .NET Frameworks: Microsoft .NET Framework 4.5, .NET for Windows Store Apps (previously known as WinRT) for Unity and the Transient Fault Handling Application Block.
  • Rich development environment: Microsoft Visual Studio 2012, Professional, Ultimate, or Express editions.

For the Data Access Application Block, the following is also required:
  • A database server running a database that is supported by a .NET Framework 4.5 data provider.

For the Logging Application Block, the following may be required:
  • If you are using the Message Queuing (MSMQ) Trace Listener to store log messages, you need the Microsoft Message Queuing (MSMQ) components installed.
  • If you are using the Database Trace Listener to store log messages, you need access to a database server.
  • If you are using the E-mail Trace Listener to store log messages, you need access to an SMTP server.

For the Semantic Logging Application Block, the following may be required:
  • If you are using the SQL Database Sink to store log messages, you need access to a SQL Server database server. The following are supported: SQL Server 2008 and higher, SQL Server LocalDB, Windows Azure SQL Database.
  • If you are using the Windows Azure Sink to store log messages, you need access to a Windows Azure storage account. You must also install the Windows Azure SDK Version 1.8.

For the Transient Fault Handling Application Block, the following is required to install the NuGet package:
  • NuGet 2.2. This is included in Visual Studio 2012 Update 2. Once the package is downloaded, you can copy the assemblies to a machine that does not have NuGet 2.2 and use the block there.
If these dependencies are not met, you may not be able to use certain Enterprise Library features.

Learning More

The following learning resources are recommended:

Providing feedback

Microsoft would appreciate feedback on any issues found, or any other general comments on this release.
To report a bug, use online Issue Tracker. Other feedback or questions can be posted on the Enterprise Library Codeplex forum.
We look forward to your comments!

Support

Community support is provided via Enterprise Library Codeplex forum.

Known Issues

  • If you are using the Transient Fault Handling Application Block, you should ensure that you are using version 4.0.30319.18003 or later of mscorlib.dll, otherwise you may see a VerificationException exception at run time. For more information, see http://support.microsoft.com/kb/2748646.
  • If you are using the Transient Fault Handling Application Block, you must have NuGet 2.2 in order to install the NuGet package. Note that this update is included in Visual Studio 2012, Update 2.
  • To run the coded UI tests in the Reference Implementation solutions, you must have the Visual Studio 2012 Ultimate edition.
  • The Semantic Logging Application Block uses the TraceEvent library (http://bcl.codeplex.com/wikipage?title=TraceEvent) internally. The Globalization Warnings reported by FxCop static analysis in this library have not been addressed.
  • The Semantic Logging Application Block running out-of-process only supports logging events authored using the managed EventSource class.
  • Using the Semantic Logging Application Block, you should not new up a listener, write a log message, and the dispose the listener. The typical usage pattern is to initialize listeners during application start up, log messages while the application is running, and then dispose the listeners during application shutdown.
  • When you author a custom EventSource to use with the Semantic Logging Application Block, you should only use enum types of int32 or int64. For more information, see http://connect.microsoft.com/VisualStudio/feedback/details/785409/eventsource-manifest-generation-creates-wrong-map-values-for-enum-types-other-than-int32-or-int64.
  • The scripts included with the Semantic Logging Application Block to create a database for the SqlDatabaseSink only support SQL Server 2008 or higher, SQL Server LocalDB, Windows Azure SQL Database.
  • Localized event source using EventSourceAttribute.LocalizationResources when using Semantic Logging Application Block in process is not currently supported.
  • The Logging Application Block declarative configuration does not support runtime configuration changes.
  • If you are writing to the Windows Event Log using the Logging Application Block from an application that does not run with admin rights, you must ensure that you add the event source first by using the following PowerShell command:
New-EventLog -LogName Application -Source 'Enterprise Library Logging'
  • Documentation has not been tested for this release and the final documentation will be available later.
  • QuickStarts and sample code included have not been extensively tested.

Change Log

Global Changes

All the blocks have been updated to the .NET 4.5 Framework.

Support for configuration by using Group Policy has been removed from this release.

Instrumentation of the blocks has been removed in this release.

The dependency on Unity has been removed from all blocks including Common. The only exception is the Policy Injection Application Block which takes a dependency on Unity.Interception.

Deprecated Blocks

The following blocks have been deprecated and removed from the Enterprise Library.
  • Caching Application Block
  • Cryptography Application Block
  • Security Application Block

New Blocks

Enterprise Library includes the following new blocks.
  • Semantic Logging Application Block
  • Transient Fault Handling Application Block (this block was previously a part of the Enterprise Library Integration Pack for Windows Azure)

Data Access Application Block

The provided SQL Server scripts now support SQL Server 2005 or later. In previous versions of Enterprise Library, the scripts supported SQL Server 2000 or later.
The tests for the Data Access Application Block now use Microsoft SQL Server 2012 Express LocalDB.
Data Access Application Block objects can be created directly from configuration without using a DI container.
The OracleClient data provider is deprecated in version 4.5 of the .NET Framework; features in the current version of Enterprise Library that rely on this data provider are also deprecated. These features may be removed in a subsequent release of Enterprise Library.

Exception Handling Application Block

Exception Handling Application Block objects can be created directly from configuration without using a DI container.

Logging Application Block

Rolling Behavior

The behavior of the RollingFlatFileTraceListener class has changed when the file is set to roll at midnight.
Take the following scenario:
  • On Monday, trace message #1 is written by the RollingFlatFileTraceListener trace listener.
  • On Tuesday, no trace messages are written to the log.
  • On Wednesday, no trace messages are written to the log.
  • On Thursday, trace message #2 is written by the RollingFlatFileTraceListener trace listener.

Previously trace message #1 would have appeared in a log file dated Wednesday, because the RollingFlatFileTraceListener trace listener rolled the log when it wrote a message.
Now, trace message #1 appears in a log file dated Monday, because the RollingFlatFileTraceListener trace listener rolls the log every day at midnight.

JSON Formatter

The Logging Application Block now includes a JSON formatter.

The WmiTraceListener Class

The WmiTraceListener class has been removed from this block.

Email Event Listener

Fixed several bugs that resulted in null reference exceptions being thrown when providing invalid configuration data for the email event listener.

MSMQ Event Listener

More error checking for configuration settings was added to this listener.
A new constructor was added to facilitate creating MSMQ event listener objects.

Rolling Flat File Event Listener

A new constructor was added to facilitate creating rolling flat file event listener objects.

AsynchronousTraceListenerWrapper

This new wrapper class enables you to use existing listeners to write messages asynchronously.

Semantic Logging Application Block

The internal implementation has changed since the CTP release. The event listener implementations have been replaced by a set of Sink classes and an ObservableEventListener class. This has decoupled the event destinations from the event listener and enabled additional extensibility scenarios.
The database schema has changed since the CTP release. You will need to recreate any logging databases using the DatabaseSink.sql script.
The GenericDatabaseSink has been removed from the block since the CTP release.

Transient Fault Handling Application Block

The following changes have been made to the Transient Fault Handling Application Block since it was released as part of the Enterprise Library Integration Pack for Windows Azure.
The classes located in the namespaces in the following list can now be found in Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling:
  • Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.SqlAzure
  • Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.ServiceBus
  • Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.AzureStorage
  • Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.Configuration
  • Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.Cache

The PowerShell script Update-EntlibConfiguration.ps1 updates the configuration files in an existing project to reflect the changes in namespaces. Visual Studio tools help you fix your code when it detects the changed namespaces.

Policy Injection Application Block

The call handlers have been moved from the individual blocks in the Policy Injection Application Block.

Validation Application Block

The ValidationFactory class no longer automatically builds its configuration from the configuration file. You must now invoke the SetDefaultConfigurationValidatorFactory method to load the configuration from the configuration file. This is a breaking change.
The throwIfSet parameter of the SetDefaultConfigurationValidatorFactory method of the ValidationBlock has been removed. The method will not throw an exception if the configuration has already been set.

Unity
  • The Unity assembly is now Security Transparent.
  • Unity now supports NetCore (Windows Store apps).
  • The bug that caused a first chance exception when registering a singleton is fixed.
  • The bug that resulted in static properties not being filtered out when doing property injection is fixed.
  • Internally, the WinRT namespaces that support Unity in Windows Store apps have been renamed to NetCore.
  • Unity now supports resolving objects of type Lazy<T>
  • Unity now supports registration by convention through the new RegisterTypes method.
  • Unity now includes support for ASP.NET MVC and ASP.NET Web API.


New Post: Using the RemoteServiceTraceListener from a WPF Smart Client??

$
0
0
Would it be possible to implement the RemoteServiceTraceListener from an WPF smart Client? We are currently using the Logging block on the server side and this would make our remote logging implementation easy.

Much Thanks,

Jon

New Post: Enterprise Library 6.0 - Error Logging to a database

$
0
0
I'm new to enterprise library, and I'm attempting to log a test message to the local sql server database.

Yesterday, I was able to log a message to a rolling flat file, by using the Edit Server Configuration File Editor to create code for web.config and then executing the below lines of C#

using System;
using System.ComponentModel.DataAnnotations;
using System.Web.DynamicData;
using System.Diagnostics;
using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using Microsoft.Practices.EnterpriseLibrary.Logging.Database;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common;




namespace Test_Environment
{
public partial class _Default : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        System.Collections.IList visibleTables = Global.DefaultModel.VisibleTables;
        if (visibleTables.Count == 0)
        {
            throw new InvalidOperationException("There are no accessible tables. Make sure that at least one data model is registered in Global.asax and scaffolding is enabled or implement custom pages.");
        }
        Menu1.DataSource = visibleTables;
        Menu1.DataBind();

        LogEntry logEntry = new LogEntry { Message = "Error Message", Severity = TraceEventType.Error };
        Logger.SetLogWriter(new LogWriterFactory().Create());

        Logger.Write(logEntry);

    }
}
I then used the configuration editor to create new xml code for web.config to log to a database. My config file is below.

<?xml version="1.0"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
<dataConfiguration defaultDatabase="Connection String" />
  <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
      <add name="Database Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          databaseInstanceName="Connection String" writeLogStoredProcName="WriteLog"
          addCategoryStoredProcName="AddCategory" />
    </listeners>
    <formatters>
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"
          name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category" />
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>


<system.web>
<compilation debug="true" targetFramework="4.5">
  <assemblies>
    <add assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  </assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="4.0"/>
</system.web>

<connectionStrings>
<add name="TPAReportEntities" connectionString="metadata=res://*/TPAReport.csdl|res://*/TPAReport.ssdl|res://*/TPAReport.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=AppDevVMTPA02;initial catalog=TPAReport;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient"/>
<add name="Connection String" connectionString="Database=Database;Server=(local)\SQLEXPRESS;Integrated Security=SSPI"
         providerName="System.Data.SqlClient" />
</connectionStrings>

<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
</entityFramework>
</configuration>

My database structure was created from a script located at \Blocks\Logging\Src\DatabaseTraceListener\Scripts.

Here's my issue. I get an error in the C# code on the following line:

Logger.SetLogWriter(new LogWriterFactory().Create());

The error states that "Database provider factory not set for the static DatabaseFactory. Set a provider factory invoking the DatabaseFactory.SetProviderFactory method or by specifying custom mappings by calling the DatabaseFactory.SetDatabases method."

Please help. I'm evaluating Enterprise Library to determine if this is the logging framework my company will use for all new projects. I would like to be able to create code to log to a database before making a recommendation.

New Post: Using the RemoteServiceTraceListener from a WPF Smart Client??

$
0
0
I don't think you can use the RemoteServiceTraceListener from a WPF application because it is contained in a Silverlight assembly.

Now, the Remote Logging Service is just a WCF service so it should be quite easy to Add a Service Reference and consume the service from a WPF application. If you wanted Enterprise Library integration on the WPF side you could create a Trace Listener based off of the RemoteServiceTraceListener code.


~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

New Post: Enterprise Library 6.0 - Error Logging to a database

$
0
0
To get past the exception you can set the DatabaseFactory:
DatabaseFactory.SetDatabaseProviderFactory(new DatabaseProviderFactory());
LogWriterFactory logWriterFactory = new LogWriterFactory();
            
Logger.SetLogWriter(logWriterFactory.Create()); 
            
LogEntry logEntry = new LogEntry { Message = "Error Message", Severity = TraceEventType.Error };
            
Logger.Write(logEntry);
I would recommend reading (at least some of) the Developer’s Guide to Microsoft Enterprise Library (2nd edition) if you haven't already done so.


~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to

New Post: System.Reflection.TargetInvocationException:FileLoadException StorageClient

$
0
0
I am new to Azure & c#, I just develop a Azure deployment using Autoscaling blocking.

All codes are followed this: http://www.windowsazure.com/en-us/develop/net/how-to-guides/autoscaling/.

But it don`t work, when i debug it on simulator,exceptions were raised when :
 scaler = EnterpriseLibraryContainer.Current.GetInstance<Autoscaler>();
i got those error message.which was not in English,

it in English should be liked that:
Microsoft.WindowsAzure.ServiceRuntime Critical: 31337 : System.Reflection.TargetInvocationException: some exception with object been invoked。 ---> System.IO.FileLoadException: can not load file or application set “Microsoft.WindowsAzure.StorageClient, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”
or its dependence. application manifest found did not matched with which referenced. (Exception from HRESULT:0x80131040).
How to fix this error?

Thanks & regards.

whole exception message:
Microsoft.WindowsAzure.ServiceRuntime Critical: 31337 : System.Reflection.TargetInvocationException: 调用的目标发生了异常。 ---> System.IO.FileLoadException: 未能加载文件或程序集“Microsoft.WindowsAzure.StorageClient, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)
在 Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.AzureStorage.AzureStorageAccount..ctor(String storageAccount)
在 lambda_method(Closure )
--- 内部异常堆栈跟踪的结尾 ---
在 System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
在 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
在 System.Delegate.DynamicInvokeImpl(Object[] args)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ConstantParameterValue..ctor(Expression expression)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.TypeRegistration.BuildDependencyParameter(Expression arg)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.TypeRegistration.<get_ConstructorParameters>b__0(Expression arg)
在 System.Linq.Enumerable.<>c__DisplayClass123.<CombineSelectors>b__11(TSource x)
在 System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()
在 System.Linq.Buffer1..ctor(IEnumerable1 source)
在 System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.Unity.UnityContainerConfigurator.GetInjectionMembers(TypeRegistration registrationEntry)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.Unity.UnityContainerConfigurator.Register(TypeRegistration registrationEntry)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.Unity.UnityContainerConfigurator.RegisterAllCore(IConfigurationSource configurationSource, ITypeRegistrationsProvider rootProvider)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ChangeTrackingContainerConfigurator.RegisterAll(IConfigurationSource configurationSource, ITypeRegistrationsProvider rootProvider)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.ConfigureContainer(ITypeRegistrationsProvider locator, IContainerConfigurator configurator, IConfigurationSource configSource)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.ConfigureContainer(IContainerConfigurator configurator, IConfigurationSource configSource)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.CreateDefaultContainer(IConfigurationSource configurationSource)
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.CreateDefaultContainer()
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.SetCurrentContainerIfNotSet()
在 Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.get_Current()
在 MonitorRole.WorkerRole.OnStart() 位置 E:\c\vc\OnvelopPaasTest\MonitorRole\WorkerRole.cs:行号 52
在 Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
在 Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRole(RoleType roleType)
在 Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<InitializeRole>b__0()
Viewing all 1928 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>