Unhandled exceptions can only be logged in detail into audit logs when
SendExceptionsDetailsToClients set true. But exception should not be send to clients in production.
I don't konw why audit logging module can not get the exception detail,is it triggered by action filter? It runs after exception filer?
thanks for any help!
I solved the problem.As it is said in the question,SendExceptionsDetailsToClients is the key. I checked the source code and found that audit log also flows this setting.
Just custom a converter to repalce the AuditLogInfoToAuditLogConverter, and modify these 2 lines ,both set true.
//AuditLogInfoToAuditLogConverter.cs
var remoteServiceErrorInfos = auditLogInfo.Exceptions?.Select(exception => ExceptionToErrorInfoConverter.Convert(exception, options =>
{
options.SendExceptionsDetailsToClients = true;//ExceptionHandlingOptions.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = true;//ExceptionHandlingOptions.SendStackTraceToClients;
}))?? new List<RemoteServiceErrorInfo>();
Related
When I call Hub method I get frame response:
{"invocationId":"1","type":3,"error":"An error occurred while updating
the entries. See the inner exception for details."}
How can I get detailed error report (row and file where error occurred) without manually debugging and using step over and check where the code raise exception.
On net I found plenty codes where EnableDetailedErrors is used
services.AddSignalR(options =>
{
options.Hubs.EnableDetailedErrors = true;
});
but options (at least in version 1.0.0-alpha2-final) does not have property Hubs.
This is what you need to do in core (not sure the exact version this was added):
// signalR
services.AddSignalR(options =>
{
if (Environment.IsDevelopment()) {
options.EnableDetailedErrors = true;
}
});
It goes without saying that the reason this is disabled by default in production is for security reasons. So be careful not to expose things you may not wish 'hackers' to see in any of the exceptions you may throw.
Implementing the above setting will reveal a more detailed message in the browser console, whcih you can also see in the websocket debugging tab:
Quick tip:
I've set up SignalR twice now on ASPNetCore and I think I've made the same mistake both times:
// from typescript client arguments are passed like this
this.hubConnection.invoke('SendMessage', 'simon', 'hello');
// not like this
this.hubConnection.invoke('SendMessage', ['simon', 'hello']);
Also invoke will wait for a response, while send does not. So you may not see errors using send.
Currently the option to enable detailed errors is not implemented. There is an issue tracking this. My recommendation would be to turn on logging on the server side - the original exception will be logged there.
cannot tell if this issue is the same as some others posted. ours simply throws a msg, but it appears CMIS connection related - our application uses CMIS/Alfresco. i am not very familiar, but we have a server related to it. not sure if a power outage is related to the fact that we this error[pwr outage yesterday, then mysteriously this error was later noticed]. we normally post information on the web page that is populated by our sql data[a table field populates a textarea/text editor] - instead we get the error above: "CMIS connection issue". that verbiage comes from a file that instantiates connection with CMIS, here is the related code:
//Check cmis service connect or not
try{
$client = new CMISService($repo_url, $repo_username, $repo_password);
}catch (Exception $ec) {
echo "CMIS connection issue";
echo "<br >\n" ;
echo $ec->getMessage() ;
die;
}
the CMISService parms have not changed, and they appear to be proper values. i even tried "admin", and "root" as "repo_username" in addition to the defined username.
Ideas on what we can check?
I am trying to run the Csharp sampleAppAdvanced from this code https://github.com/evernote/evernote-cloud-sdk-windows
I substituted the consumer key and secret with those that I got in the email when I requested the API key.
ENSessionAdvanced.SetSharedSessionConsumerKey("xyz","123","sandbox.evernote.com");
if (ENSession.SharedSession.IsAuthenticated == false)
{
ENSession.SharedSession.AuthenticateToEvernote();
}
But I always end up hitting an error at this point
ENNoteRef myRef = ENSession.SharedSession.UploadNote(myNoteAdv, null);
With exception reading "Exception of type 'EvernoteSDK.ENAuthExpiredException' was thrown."
On the console the error reads "EvernoteSDK: ENSession is unauthenticating."
Am I missing something? I know the Application is authorized for access.
The other sample code called sampleApp, doesn't throw an error but doesn't display notes either.
When you register the api, did you choose Basic Access or Full Access?
We've been working on an application for about 2 months, and everything was going perfectly.
we were using PHP SDK and offline mode in permissions for login
But since some days ago after recent changes in Facebook api and removing offline mode we started facing the problem of "Uncaught OAuthException: An active access token must be used to query information about the current user."
The main problem is that it does happen after a while working in our app (about 10 mins) but at the same time when we check the validity of the token via this link
we see that the token is still valid on the other hand the cookie does still exist and it doesn't expire but we get this error :
"Uncaught OAuthException: An active access token must be used to query information about the current user"
I've already visited this link
and I downloaded the latest version but it didn't help could anyone help us please where might be making mistake?
Thanks for responses, I think same as yacon
it seems there's a bug when accessing facebook->api(/me) at the moment we are handling
some parts of the app with javascript which is a real headache to use javascript sdk
and PhP sdk alongside with each other
You can solve this simply store accesstoken to session variable after getLoginUrl
$facebook->getLoginUrl(...)
then whenever you initialize facebook
$facebook = new Facebook(array(
'appId' => Yii::app()->params['facebook_appId'],
'secret' => Yii::app()->params['facebook_appSecret'],
));
get the accesstoken from session and set it using setAccessToken
$facebook->setAccessToken(Yii::app()->session['access_token']);
I handle this situation in this way
1.i get the access token for 1 hour validity
2.extend the token to 60 days validity
3.save that token to session and use it for all project queries.
try{
$facebook_uid = $facebook->getUser();
$facebook->setExtendedAccessToken();
$accessToken = $facebook->getAccessToken();
$fbuser = $facebook->api('/me');
$session['api_me'] = $fbuser;
$session['tokenValue'] = $accessToken;
}catch (Exception $e) {
facebook_uid =null;
}
I think there is a bug in the api. When I use $facebook->api('/'.$facebook_uid) instead of ->api('/me') it works.
The following code is throwing Exception. I don't get what mistake I am making in the code. Can somebody help me figure out please. I think it is of some security rights issue. If so, how can I give the security rights to any user or application to access this windows service programmatically?
Dim sc As New ServiceController
sc.ServiceName = "DataLoad"
If sc.Status = ServiceControllerStatus.Stopped Then
sc.Start()
Else
sc.Stop()
End If
Exception:
System.InvalidOperationException: Cannot open DataLoad service on computer '.'. --->
System.ComponentModel.Win32Exception: Access is denied --- End of inner exception stack trace --- at
System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess) at
System.ServiceProcess.ServiceController.Start(String[] args) at
System.ServiceProcess.ServiceController.Start() at
WEBSITE.DataLoad.Submit1_ServerClick(Object sender, EventArgs e) in C:\Inetpub\wwwroot\WEBSITE\a\DataLoad.aspx.vb:line 46
Thank you!
You can use the subinacl tool for that
SUBINACL /SERVICE \\MachineName\ServiceName /GRANT=[DomainName\]UserName[=Access]
To be specfic for your case:
subinacl /service DataLoad /GRANT=YOURDOMAIN\[User in appdomain for WEBSITE]=TO
Where TO means
T : Start Service
O : Stop Service
all options for [Access] are:
F : Full Control
R : Generic Read
W : Generic Write
X : Generic eXecute
L : Read controL
Q : Query Service Configuration
S : Query Service Status
E : Enumerate Dependent Services
C : Service Change Configuration
T : Start Service
O : Stop Service
P : Pause/Continue Service
I : Interrogate Service
U : Service User-Defined Control Commands
See Method 3 in this kb article
I found a solution to this problem by providing the machine name of the machine which is currently executing the service in the ServiceController overloaded constructor that takes 2(two) arguments i.e.
public ServiceController(/my service's name string/, System.Environment.MachineName/this machine which is executing the service/)
The version of .Net this solution was tested on was 4.5, hope this helps anyone still looking for a solution.
Here is what you need to do in code:
ServiceController serviceController = new ServiceController("myServiceName", System.Environment.MachineName);
GetServiceHandle requires some access rights. If it works when you run it as an Admin user, but not as a normal user, then maybe this article can help.
It clearly shows you how to manually give a Windows User rights to start and stop services (or set other permissions):
http://thommck.wordpress.com/2011/12/02/how-to-allow-non-admins-to-start-and-stop-system-services/
In my case, I determined that I needed to adjust the security on my service to allow it be be restarted by a separate "watchdog" service if my service fails.
First, open mmc.exe, then add the "Security Configuration and Analysis" and Security Templates" snap-ins.
Then create a new blank security template from the "Security Templates" item, give it a name, and hit OK to save it on your local disk drive somewhere convenient.
Then open "Security Configuration and Analysis" and choose "Open Database...", give it a name, and save it in the same directory as the previous step. When an "Import Template" window appears, open the *.inf file in the same directory.
Next, right-click "Security Configuration and Analysis" and choose "Analyze Computer..." The following will appear:
Double-click on "System Services", locate and double-click on your service, then click the checkbox "Define this policy in the database" and click on the "Edit Security" button.
This is where it becomes different than what is described in the link #JOG posted since I am using Windows 8.1--I enabled "start, stop and pause" for "INTERACTIVE" and "SERVICE"
FYI, I performed the above by following this guide as #JOG suggested: https://thommck.wordpress.com/2011/12/02/how-to-allow-non-admins-to-start-and-stop-system-services/
If you are already having the Service user as LocalSystem(the high privilage user) the problem is not security. Also I had that problem before and its the status vrs starting it again or stopping it when already commande to stop().
You see the service status its not changed on demand, so even if you coded
//this will start the process but the
//sc status will take some time to change
//when that happens and you try to start
//the already started service it will give you
//your error
servicec.start();
Soo you need to do this:
msdn ServiceController.waitforstatus
Dim sc As New ServiceController
sc.ServiceName = "DataLoad"
If sc.Status = ServiceControllerStatus.Stopped Then
sc.Start()
// this makes it wait for the status to change
// and no it wont slow down anything at all.
sc.waitforstatus(ServiceControllerStatus.started)
Else
sc.Stop()
sc.waitforstatus(ServiceControllerStatus.stopped)
End If
This will solve your problem like it did mine.