Logging via email with Serilog (.NET 6.0) - serilog

I am working on a web app where we are trying to configure logging using Serilog and using email as a log delivery system.
In my Program.cs file, I have
builder.Host.UseSerilog((ctx, lc) => lc
.ReadFrom.Configuration(ctx.Configuration));
In my appsettings.json file, I have two WriteTo's: one to a local file on my machine and one to email.
The WriteTo file option is working just fine as the program stands today; when running the code in VS2022, it logs the information to the file location specified in my appsettings.json file. The WriteTo email option is not working at all, I am not receiving any emails despite logs being written successfully to the local file.
The WriteTo for email is configured as follows (with identifying information removed):
{
"Name": "EmailCustom",
"Args": {
"enableSsl": false,
"fromEmail": "appname#ourorg.com",
"mailServer": "ourmailserver.ourorg.com",
"mailSubject": "Error in App",
"smtpPort": 25,
"toEmail": "myemail#ourorg.com"
}
}
I have looked far and wide, and have not seen anyone else bring up this issue or have an example of an email configuration listed. Has anyone successfully set up email logging with Serilog in .NET 6.0 who can help me out? Thanks!

The same topic: Serilog WriteTo.Email() failing
It seems that Serilog.Sink.Email uses old version of MailKit

Related

authentication failures with external users

I am trying to have SCM Manager accept users from my organization so they can log in using their Windows username and password. I have installed the LDAP plugin, but it still doesn't recognize my own windows username and password from my organization
I don't really understand - I think I shouldn't even need LDAP and some kind of basic authentication should be able to figure out my username password on windows active directory etc type of thing...
Do I need the SSL to do this? It says various things about a binding problem.
I am using the custom LDAP profile. I put wsproxy in the proxy server area and enabled. I have no idea what that means but it was the same configuration that I saw in a previous installation of SCM-server that worked with organizational credentials on windows server.
This problem occurred after upgrading from version 1.6 to 2.9.
Though I was not the person who set it up on v1.6.
UPDATE: what's needed is not LDAP plugin, but rather understanding how to configure active directory for SCM - previously, in 1.X versions active directory plugin worked under the hood - now it needs to be configured and I have no idea how -- also the active directory plugin for 1.X is no longer available - if you could provide me with that code I might be able to see how it connects to AD and then go from there on version 2.X - any chance you can get me access to the code of https://bitbucket.org/sdorra/scm-manager/wiki/active-directory-plugin??
We have an issue for the LDAP plugin saying that the migration of the ldap password may fail (though I cannot reproduce this), so maybe this happened with your migration, too. Proxy settings should not play any part in this game, because as far as I know company ldaps aren't behind a proxy.
The configuration for 2.x should be the same as for 1.60. We haven't changed anything here. So first I would try to reenter the "Connection Password". If this still fails, please use the "Test connection" feature. Enter a valid authentication here. This tells you, on what level the connection fails and may show you an exception with further information.
Feel free to post your results here for further investigation.

Random error in RDLC - Access to the path C:\Windows\TEMP

I am trying to generate a rdlc report and save it as pdf. It works perfectly fine on the localhost but after deploying it on the server after successfully generation of some files it stops randomly with below exception
System.UnauthorizedAccessException
Access to the path 'C:\Windows\TEMP\expression_host_791eafe958ba48999639e489485a25c1.dll' is denied.
I have tried giving full access to IUSR, IIS_IUSRS, IIS APPPOOL\MyPOOL, NetworkService and even disposing my localreport and setting permissions, example code below:
using (var lr = new LocalReport())
{
PermissionSet permissions = new PermissionSet(PermissionState.None);
permissions.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
permissions.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
lr.SetBasePermissionsForSandboxAppDomain(permissions);
I even restarted the server, recycled app pool and also tried resetting IIS by aspnet_regiis -i
Nothing worked till now. Any help would be really appreciated.
This mostly an IIS issue.
Change the AppPool's Identity to LocalSystem, you shouldn't get the errors
I had the same scenario you described "It works perfectly fine on the localhost but after deploying it on the server...". What worked for me was:
1- check the new directory where the .rdlc file is located on the server. Get the full path
2- make sure the file and directory are the same in your code (and you're not pointing to the same old location, localhost)

My file gets uploaded with my fineuploader setup but yet it shows upload failed. What is the reason for this?

I'm using fine uploader in a rails application and I've made a gist of what my method and my jQuery script looks like here
Here's my console log
and here's my upload returning failed when it actually didn't fail:
I thought this was just with my development server where files are being uploaded to FS but I tried it with my staging server that sends the files to a CDN server and it is still successfully uploaded with the same upload failed prompt:
It looks like you are not including the mandatory "success" property in your response. It must be set to a value of true to indicate success. This is mentioned in the server documentation at http://docs.fineuploader.com/endpoint_handlers/traditional.html. There is an open case to remove this requirement for newer browsers, scheduled for version 6.0. See https://github.com/FineUploader/fine-uploader/issues/1325 for specifics.

404 error when accessing Struts2 Web application

I had created a web application and committed the code in CVS. The web application is working good in my machine. When i tried to import the same code in another machine i am getting 404 error. I tried importing the code via ftp from my machine to another machine and also checking out the code from CVS. But still i get 404 error.
I also noticed that there is no error that had been captured in the console or in the application's log. Could someone help me in how to proceed further in identifying the issue. Please let me know if i need to post any further details regarding the issue.
I notice this issue to be in the Websphere server. I tried hosting the application in different machine and found that in few machine the same code is working good and some it is not. Is there any way to compare the server configuration?
In the WAS server 6.1 i added the below value in the web container and the application worked fine.
Steps:
In the server admin console, click on Application Server--> --> Web container--> custom properties.
Add the name as com.ibm.ws.webcontainer.invokefilterscompatibility and value as true.
Thank you all for the response.

Grails App deployment on Micro Cloud Foundry

I tried to deploy a simple hello world application on Micro Cloud Foundry. I went through the process that mentioned in video and set up every thing (My IDE is STS eclipse and Windows 7). When I wanted to make a server on Micro Cloud Foundry: 1) I could not set my server host name to my domain for example "multisite.cloudfoundry.me" it said "The currently selected server type does not support remote hosts" and forced me to put "localhost" as the server name. 2) When I went through the process it started my Grails application and seemed it was running well but the url was broken "http://12431asd.multisite.cloudfoundry.me/" (It asked me for Grails app on this domain I choose "12431asd") and I got the message "VCAP ROUTER: 404 - DESTINATION NOT FOUND". when I tried this url "http://api.multisite.cloudfoundry.me/" I get the message "Welcome to VMware's Cloud Application Platform".
I appreciate any help and suggestions.
Reza
When you add a CloudFoundry server leave the first pane with the default settings and then on the second pane select the "Microcloud" url option setting the name to "multisite" in the popup dialog. Once the plugin has contacted your instance you can go ahead and put the email and the password in.
From there you should just be able to deploy by dragging the application to the server instance in your servers tab, setting the url in the dialog that follows. Once deployed you can double-click the application instance in the server tab and adjust its properties.
Can you verify that when you deployed the application, it's state was started? (it should say next to the application name under the server)

Resources