I'm using serilog in a .NetCore 3.1 application.
loggerFactory.AddSerilog();
Log.Logger = new LoggerConfiguration().MinimumLevel.Information()
.WriteTo.File("test-{Date}.txt").CreateLogger();
app.UseSerilogRequestLogging();
When i run a application and try to access file, i'm getting error saying
"File cannot be opened because it is being used by another process"
Am i missing any setting to be added?
Update:
Even after adding shared:true - Did not work.
Log.Logger = new LoggerConfiguration().MinimumLevel.Information()
.WriteTo.Async( o => o.File("test1.txt", shared: true)).CreateLogger();
Related
As the title says, I'm trying to create a GAE + GWT project using Objectify but I can't even get it off the ground. I'm sure I'm missing something simple but doesn't seem to be working.
Here is what I've done so far:
Create a new project and added guava-17.0.jar, guava-gwt-17.0.jar, objectify-5.0.3.jar, and objectify-gwt-1.1jar to my WEB-INF\lib folder. These are all the latest versions of these jars.
Run the application. Send a simple RPC command, server responds, and client successfully receives response (onSuccess() is called).
Add the line <inherits name="com.googlecode.objectify.Objectify" /> to my gwt.xml file per Objectify-GWT's website which is supposed to enable Objectify in GWT.
Run the application. The application starts, same RPC command is sent, server receives and responds, but the client says the command was a failure (onFailure() is called).
I am using the boiler-plate code that is pre-populated when first create a new web application. For reference, here is the RPC command:
private void sendNameToServer() {
// First, we validate the input.
errorLabel.setText("");
String textToServer = nameField.getText();
if (!FieldVerifier.isValidName(textToServer)) {
errorLabel.setText("Please enter at least four characters");
return;
}
// Then, we send the input to the server.
sendButton.setEnabled(false);
textToServerLabel.setText(textToServer);
serverResponseLabel.setText("");
greetingService.greetServer(textToServer,
new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
// Show the RPC error message to the user
dialogBox
.setText("Remote Procedure Call - Failure");
serverResponseLabel
.addStyleName("serverResponseLabelError");
serverResponseLabel.setHTML(SERVER_ERROR);
dialogBox.center();
closeButton.setFocus(true);
}
public void onSuccess(String result) {
dialogBox.setText("Remote Procedure Call");
serverResponseLabel
.removeStyleName("serverResponseLabelError");
serverResponseLabel.setHTML(result);
dialogBox.center();
closeButton.setFocus(true);
}
});
}
This is the error I receive after I try to make the RPC call:
[DEBUG] [my_app] - Validating units:
[INFO] [my_app] - Module my_app has been loaded
[ERROR] [my_app] - Errors in 'com/google/gwt/dev/jjs/SourceOrigin.java'
[ERROR] [my_app] - Line 77: The method synchronizedMap(new LinkedHashMap<SourceOrigin,SourceOrigin>(){}) is undefined for the type Collections
[ERROR] [my_app] - Errors in 'com/google/gwt/dev/util/StringInterner.java'
[ERROR] [my_app] - Line 29: No source code is available for type com.google.gwt.thirdparty.guava.common.collect.Interner<E>; did you forget to inherit a required module?
[ERROR] [my_app] - Line 29: No source code is available for type com.google.gwt.thirdparty.guava.common.collect.Interners; did you forget to inherit a required module?
To me it looks like Objectify is interfering with GWT. I know they're supposed to work together so not sure what I'm doing wrong. Any advice would be appreciated.
Use objectify-gwt 1.2. It's possible that 1.1 has some issues from merging a bad PR.
You can see a sample application that uses objectify-gwt to pass a GeoPt back and forth from the client here: https://github.com/stickfigure/objectify-gwt-test
You should use objectify on the server side before trying to do this kind of stuff. Objectify is a server side peristence technology. Call it in your server code
add try catch in your service methods and print the stack trace of the exception on your server console, if you receive onFailure() on GWT that means there is a failure on the server side. You have to find what is that failure.
Now the second part is an advice:
<inherits name="com.googlecode.objectify.Objectify" />
Is a weired line for me. GWT doesn't have to know about your persistence layer.
Unless it's a revolutionary concept, I would recommend you d'ont use this type of technology that removes your hand from the controle of your db access...
I'm trying to run my .NET application, that resides in a network share from our domain, using a RDP Client.
When starting a "full" RDP session (that is, opening the whole desktop) and then running my application from the .exe file, everything works fine.
But when I set this same .exe as the Startup Application Path from the RDP Client , I get the following error:
(PS: I clipped the stack trace to the calls I found myself more important)
System.TypeInitializationException: The type initializer for 'NHibernate.Cfg.Environment' threw an exception. ---> System.ArgumentException: Incorrect Parameter. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
(...)
at System.AppDomain.get_Evidence()
(...)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at NHibernate.Cfg.Environment.LoadGlobalPropertiesFromAppConfig() in p:\nhibernate-core\src\NHibernate\Cfg\Environment.cs:line 212
at NHibernate.Cfg.Environment..cctor() in p:\nhibernate-core\src\NHibernate\Cfg\Environment.cs:line 198
As I work with shadow-copied files, I set a new AppDomain when the application has just begun (the .exe entry point):
<STAThread()>
Public Sub Main()
Try
Dim currentDirectory As DirectoryInfo = New DirectoryInfo(Directory.GetCurrentDirectory)
Dim runtimeDirectory As DirectoryInfo = New FileInfo(Assembly.GetExecutingAssembly.Location).Directory
Dim appDomainStartupSetup As New AppDomainSetup
appDomainStartupSetup.ApplicationBase = currentDirectory.FullName
appDomainStartupSetup.ShadowCopyFiles = "true"
Dim appDomainStartup As AppDomain = AppDomain.CreateDomain("StartupAppDomain", Nothing, appDomainStartupSetup)
Dim entrypointLoader As LoadBaseFiles = appDomainStartup.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly.CodeBase, "MyClass.LoadBaseFiles")
entrypointLoader.RuntimeDir = runtimeDirectory.FullName ' Setup the 'entry-point' object
entrypointLoader.StartupEntryPoint() ' Starts the Application
Catch ex As Exception
' Error Handling Here
End Try
End Sub
Public Class LoadBaseFiles
Inherits MarshalByRefObject
' Startup stuff here...
End Class
More Info
Content of my ApplicationEntryPoint.exe.config file;
I had set the CAS Policy to Full Machine Trust, but I'm not sure this still applies to .NET 4.0;
The Remote Desktop (Terminal Services) Server runs Windows Server 2003;
EDIT:
If I copy all the assemblies to a local drive (C:) and run my application from there, it will work fine.
Any advices?
It looks like you're missing an argument or pointing to an unavailable resource.
a) Is the Working Directory set for the application?
b) Is the Working Directory available to the user on login?
I have a solution with several web projects.
I have built each project into its own folder (there's about 10 projects):
/build/projA
/build/projB
/build/projC
If I call
aspnet_compiler -v / -p \"build/#{proj}\" merged/#{proj}
on each one in turn, everything is fine.
If I make all 10 calls to aspnet_compiler in parallel, I get assembly loading errors, saying the referenced assemblies are in use.
Is this a bug? Why would it be in use? It shouldn't be.
The assemblies that cant be loaded are in multiple projects, but each one has its own copy in its bin folder.
Update: it seems to occur (for some) of the assemblies that are references of references. Those loaded with complete binding information seem to work.
Here's a dump from one of the failed loadings from fuslogvw
The operation failed.
Bind result: hr = 0x80070020. The process cannot access the file because it is being used by another process.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = andrew.bullock
LOG: DisplayName = Yahoo.Yui.Compressor
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Yahoo.Yui.Compressor | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///E:/build/ProjA/
LOG: Initial PrivatePath = E:\build\ProjA\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\src_projects_proja\061ad2e7
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\src_projects_proja\061ad2e7
LOG: AppName = 627cc9a9
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\build\ProjA\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/src_projects_proja/061ad2e7/627cc9a9/Yahoo.Yui.Compressor.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/src_projects_proja/061ad2e7/627cc9a9/Yahoo.Yui.Compressor/Yahoo.Yui.Compressor.DLL.
LOG: Attempting download of new URL file:///E:/build/ProjA/bin/Yahoo.Yui.Compressor.DLL.
LOG: Assembly download was successful. Attempting setup of file: E:\build\ProjA\bin\Yahoo.Yui.Compressor.dll
LOG: Entering download cache setup phase.
ERR: Error extracting manifest import from file (hr = 0x80070020).
ERR: Setup failed with hr = 0x80070020.
ERR: Failed to complete setup of assembly (hr = 0x80070020). Probing terminated.
If you call the ClientBuildManager directly, outside of aspnet_compiler there doesn't seem to be a problem, no idea why.
var parameter = new ClientBuildManagerParameter
{
PrecompilationFlags = PrecompilationFlags.ForceDebug
};
var client = new ClientBuildManager("/", src, dest, parameter);
client.PrecompileApplication();
Trying to open a file dialog but I get an exception when calling ShowDialog. This pice of code have always worked fine but I think when I upgrade to Silverlight 4 it caused some problem.
Code:
var dlg = new OpenFileDialog { Filter = "CSV Files (*.csv)|*.csv" };
if (dlg.ShowDialog() == true)
{
Upload(dlg.File);
}
Exception:
Directory = 'dlg.File.Directory' threw an exception of type 'System.Security.SecurityException'
{System.Security.SecurityException: File operation not permitted. Access to path file.csv' is denied.
at System.IO.FileSecurityState.EnsureState()
at System.IO.FileInfo.get_DirectoryName()
at System.IO.FileInfo.get_Directory()
}
It seems like it´s problem to get options for the directory because I got correct filename and file size but no information about the directory and directory name.
If you are trying to debug the application then you will get this security exception. Try to run without debugging and check if you are still getting this error.
I have this wpf form; the call to InitializeComponent() brings up this message:
Binding Failure was detected.
The assembly with display name
'Csla.Luna' failed to load in the
'Load' binding context of the
AppDomain with ID 1. The cause of the
failure was:
System.IO.FileNotFoundException: Could
not load file or assembly 'Csla.Luna,
Version=3.6.1.0, Culture=neutral,
PublicKeyToken=93be5fdc093e4c30' or
one of its dependencies. The system
cannot find the file specified.
File name: 'Csla.Luna, Version=3.6.1.0, Culture=neutral,
PublicKeyToken=93be5fdc093e4c30'
=== Pre-bind state information ===
LOG: User = DOMAIN\blah.blah
LOG: DisplayName = Csla.Luna, Version=3.6.1.0, Culture=neutral,
PublicKeyToken=93be5fdc093e4c30
(Fully-specified)
LOG: Appbase = file:///D:/MyPath/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : PresentationFramework,
Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file:
D:\MyPath\bin\Debug\Myapplication.vshost.exe.Config
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Csla.Luna, Version=3.6.1.0,
Culture=neutral,
PublicKeyToken=93be5fdc093e4c30
LOG: Attempting download of new URL
file:///D:/MyPath/bin/Debug/Csla.Luna.DLL.
LOG: Attempting download of new URL
file:///D:/MyPath/bin/Debug/Csla.Luna/Csla.Luna.DLL.
LOG: Attempting download of new URL
file:///D:/MyPath/bin/Debug/Csla.Luna.EXE.
LOG: Attempting download of new URL
file:///D:/MyPath/bin/Debug/Csla.Luna/Csla.Luna.EXE.
We use Csla but in a data access component that is not developed by me;
I don't know what Csla.Luna is, and I couldn't find anything about it online. Any help?...
The only "out of the ordinary" thing that I am doing on that form is that I am binding to some ObjectDataProviders that call static methods accessing the database, but It worked so far, and I can't tell whether this is the problem or not.
Any help would be appreciated. Can't believe that Google has no clue about this Csla.Luna thing.
I don't believe Csla.Luna is part of the original framework. You should try and contact the person in charge of developing the data acces component to find out more about it.
In any case, it seem that you are missing this file (Csla.Luna.dll).
You could also use Reflector to pinpoint the location of the call to this Csla.Luna assembly...