Insight messages not showing in Visual Studio or Azure - azure-application-insights

Im seeing AI messages in the debug window but not in the diagnostics window/ hub , Azure or the application insights VS screens,
Debug window
Application Insights Telemetry: {"name":"Microsoft.ApplicationInsights.e71aa06ae1d142b4ae04393d63a71d57.Exception","time":"2016-07-16T09:46:37.7435251Z","iKey":"xyz","tags": etc
Not using a config file
for (;;)
{
var telemetryClient = new TelemetryClient();
telemetryClient.InstrumentationKey = "abc";
telemetryClient.Context.Session.Id = Guid.NewGuid().ToString();
telemetryClient.Context.User.AccountId = "Ben";
telemetryClient.Context.Component.Version = "1.0";
telemetryClient.TrackEvent("Application Start");
telemetryClient.TrackException(new ApplicationException("test exc"));
telemetryClient.Flush();
Thread.Sleep(3000);
}
This is in several solutions One a Console the other .Core . Any ideas ?
Add diagnostics shows.
Value for property 'Failed to load an item from the storage. file: 20160531051527_dbd26772482e4dbab6791b63f0ded9d3.trn Exception: System.UriFormatException: Invalid URI: The format of the URI could not be determined.
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Microsoft.ApplicationInsights.Channel.Storage.Peek()' of vshub.exe was not found. Populating it by default.: OnNext: {0}
Value for property 'Failed to load transmission from file. File full path: C:\Users\bklooste\AppData\Local\Microsoft\ApplicationInsights\vstelAIF-312cbd79-9dbb-4c48-a7da-3cc2a931cb70\20160712090841_9436f519411b4a10b4f551897382fcc6.trn, Exception: System.UriFormatException: Invalid URI: The format of the URI could not be determined.
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Microsoft.ApplicationInsights.Channel.Storage.d__14.MoveNext()' of vshub.exe was not found. Populating it by default.: OnNext: {0}
Value for property 'Failed to load an item from the storage. file: 20160712090841_9436f519411b4a10b4f551897382fcc6.trn Exception: System.UriFormatException: Invalid URI: The format of the URI could not be determined.
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)

Possibly not an answer but will help those who search for this stack trace and don't read the comments on the question.
The OPs question was resolved when they checked the Instrumentation Key.
The stack trace is generated by vshub.exe when it attempts to read the files at C:\Users\bklooste\AppData\Local\Microsoft\ApplicationInsights\vstelAIF-312cbd79‌​-9dbb-4c48-a7da-3cc2a931cb70 to send in the offline telemetry.
This offline telemetry is provided by the Application Insights Persisted HTTP package. Without knowing the actual contents of the file it seems likely there is some corruption in the file. The file should look something like the snippet below. If for some reason the file was truncated or the URI is actually malformed then this exception will be thrown.
You either need to correct the URI, or (preferrably) just delete the file.
https://vortex.data.microsoft.com/collect/v1
Content-Type:application/x-json-stream
Content-Encoding:gzip
H4sIAAAAAAAEAJV...

Related

ASP.NET Webforms Nreco PDF Generator - Exit with code 1, due to unknown error

I have a web-application built in ASP.NET Webforms VB.NET. I am creating a method for exporting the pages via urls utilising the WKHTMLTOPDF and NReco PDF Generator libraries.
During my local development, everything seems to work ok, other than the odd "Process is already in use" when i have rebooted my PC and not even performed anything prior.
When I have uploaded the site to our server, the PDF library seems to never work and I am faced with a not so obvious error. When I attempt to export any page to anything, or even text to a pdf, I get this within our logs:
Inner Exception Type: NReco.PdfGenerator.WkHtmlToPdfException
Inner Exception: Exit with code 1, due to unknown error. (exit code: 1)
Inner Source: NReco.PdfGenerator
Inner Stack Trace:
at NReco.PdfGenerator.HtmlToPdfConverter.CheckExitCode(Int32 exitCode, String lastErrLine, Boolean outputNotEmpty)
at NReco.PdfGenerator.HtmlToPdfConverter.InvokeWkHtmlToPdf(PdfSettings pdfSettings, String inputContent, Stream outputStream)
at NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdfInternal(WkHtmlInput[] htmlFiles, String inputContent, String coverHtml, String outputPdfFilePath, Stream outputStream)
Exception Type: System.Exception
Exception: Cannot generate PDF: Exit with code 1, due to unknown error. (exit code: 1)
Source: Exporting
Stack Trace:
at NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdfInternal(WkHtmlInput[] htmlFiles, String inputContent, String coverHtml, String outputPdfFilePath, Stream outputStream)
at NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdf(String htmlContent, String coverHtml, String outputPdfFilePath)
at PROJECT.Export.DownloadFiles(List`1 list) in C:\Users\NAME\source\repos\PROJECT\Export.aspx.vb:line 252.
I have ensured the project contains all the relevant files, I have even installed WKHTMLTOPDF on both server and development machine. Utilising the CMD I can generate ANY PDF but within my application, it seems to always fail on our live production server.
My code for generating the PDF is quite simplistic:
If check = True Then
Try
'Generate PDF
'htmlToPdf.GeneratePdfFromFile(exp.URL, Nothing, "..\" & pathURL)
htmlToPdf.GeneratePdf("<h3> TEST PDF </h3> ", Nothing, "..\" & pathURL)
'Set download
download = True
'Catch exception, log it
Catch ex As Exception
ExceptionUtility.LogException(ex, "Exporting")
End Try
End If
Can anyone offer any insight as to how I can overcome this? I spent all day yesterday searching through forums and not coming to a solution!
Any help is highly appreciated.
Exit code 1 means that wkhtmltopdf was unable to render your HTML input for some reason.
To get more details (full wkhtmltopdf's console log output) you may handle LogReceived event.
PdfGenerator executes wkhtmltopdf with System.Diagnostics.Process API, so it should work exactly like if you run it (on the same server) in the command line. Differences may occur if this is ASP.NET app hosted in IIS, and in some cases app pool may be configured to use rather restrictive credentials.

.NET Core Console Application - SSL connect error

Context:
I have an n-tier dynamic-ish application that currently builds its elastic indexes at app startup.
While this was ok to get things going, I'd prefer to have a small CLI application/util that I can later re-use in some scripts and or run ad-hoc if I need to do things like, creating a new instance, seeding mock data etc.
Problem:
When I use the exact same code that worked in my dotnetcore web app's startup, in my console app, I get the following issue:
Invalid NEST response built from a unsuccessful low level call on PUT: /jobs-ng
# Audit trail of this API call:
- [1] BadRequest: Node: https://localhost:9200/ Took: 00:00:01.3948230
# OriginalException: System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.CurlException: SSL connect error
at System.Net.Http.CurlHandler.ThrowIfCURLEError(CURLcode error)
at System.Net.Http.CurlHandler.MultiAgent.FinishRequest(StrongToWeakReference`1 easyWrapper, CURLcode messageResult)
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Elasticsearch.Net.HttpConnection.Request[TReturn](RequestData requestData) in C:\Users\russ\source\elasticsearch-net-5.x\src\Elasticsearch.Net\Connection\HttpConnection-CoreFx.cs:line 78
# Request:
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
# Response:
<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
Additional Info:
Currently my ElasticClient class only gets set like this:
var uri = new Uri("https://localhost:9200");
services.AddSingleton(new ElasticClient(new ConnectionSettings(uri)));
... thus I don't explicitly set a cert anywhere. (Hasn't been required thus far)
My best guess is that the native console app is missing something that the default web app projects provide, but as to what, I don't know?
I have set DisableDirectStreaming() as per the error log, but still no change.
I believe this might be a bug within .Net Core, but I'm hoping someone knows of a work around, or way around this issue for the time being (other that having this code be part of the we apps startup? (which is what my current working solution is))
There is currently a documented issue, within the dotnet-core project's CURL implementation/usage thereof/within CURL on OSX... you get the idea. It seems to have been fixed for 1.1, but as I'm on 2.0 (and I've attempted all of the suggested fixes on the various github threads, to no success), I'm unable to verify if that fix works.
Thus the answer:
There is a bug thats preventing this from working on OSX currently.
Workaround:
Since my console app / cli-tool will run ad hoc internal to our applications network / same machine instance, I don't, in theory need HTTPS for this utility, HTTP should be sufficient. (Once I made that change, the code worked fine across the board)

Biztalk2016 The mapping does not exist. For Config Store applications, the config info has not been set

I have migrated a biztalk project from Biztalk 2009 to Biztalk 2016 and .NET 4.6.2. In old version, everything works fine, but in new version, I get an error with WCF-Custom adapter.
A message sent to adapter "WCF-Custom" on send port "PhySndGuiExportResponsePort" with URI "net.msmq://serviceserver/private/EwrServicesInQueue" is suspended.
Error details: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: The mapping does not exist. For Config Store applications, the config info has not been set.
at Microsoft.BizTalk.SSOClient.Interop.ISSOConfigStore.GetConfigInfo(String applicationName, String identifier, Int32 flags, IPropertyBag properties)
at SSOSettingsFileManager.SSOHelper.GetConfigInfo(String affiliateApplication, Boolean enableRemoteAccess)
at SSOSettingsFileManager.SSOSettingsManager.GetSettings(String affiliateApplication, Boolean enableRemoteAccess)
at SSOSettingsFileManager.SSOSettingsFileReader.Read(String affiliateApplication, Boolean enableRemoteAccess)
at SSOSettingsFileManager.SSOSettingsFileReader.ReadString(String affiliateApplication, String valueName)
at DAP.IdentityModel.Selectors.ForwardingDAPClientCredentials..ctor()
--- End of inner exception stack trace ---
at Microsoft.BizTalk.Adapter.Wcf.Converters.BehaviorFactory.ApplyEndpointBehavior(ServiceEndpoint serviceEndpoint, String wcfExtensions, String endpointBehaviorConfiguration)
at Microsoft.BizTalk.Adapter.Wcf.Config.CustomTLConfig.ApplyEndpointBehavior(ServiceEndpoint serviceEndpoint)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.CreateChannelFactory[TChannel](IBaseMessage bizTalkMessage)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.InitializeValues(IBaseMessage message)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2..ctor(IBaseMessage message, WcfTransmitter`2 transmitter)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfTransmitter`2.GetClientFromCache(String spid, IBaseMessage message)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfAsyncBatch`2.BatchWorker(List`1 messages)
MessageId: {DC4E26FC-B65B-4AE6-B2F3-01AFC5B85D6F}
InstanceID: {94A91D61-D8BE-4F74-8B06-1B4C58B36CEA}
The sendport PhySndGuiExportResponsePort is using PassThroTransmit send pipeline, transport type WCF-Custom with certificate authentication.
Run ssomanage tool see that the mapping is BtsDeploymentProperties, but not a GUID as the others. Can this cause the error?
C:\Program Files\Common Files\Enterprise Single Sign-On>ssomanage.exe -listmappings tvn.Infra
Using SSO server : biztalk2016server
Existing mappings for application 'tvn.Infra' -
(E) $ConfigStore$\BtsDeploymentProperties : BtsDeploymentProperties
Any idea to solve it is appreciated. Thank you.
Your problem isn't with the WCF adapter or the port, it's with some custom code that's trying to use SSOSettingsFileReader (from BTDF) to read SSO:
at DAP.IdentityModel.Selectors.ForwardingDAPClientCredentials..ctor()
I would look into your constructor code there, find out what SSO application name and key it's trying to find, and go from there. Chances are you didn't properly deploy your SSO config store - for example, from the command line (since the extension doesn't work in VS2015 at this point):
MSBuild.exe <btdfproj file path> /nologo /p:Configuration=Debug /t:DeploySSO

ASP.NET site authorization issue with google and youtube api's

I have implemented several google APIs in my website - to enbale contacts import and youtube uploads.
while everything works great locally (under my own development server's localhost), there are some problems using them thru the site (hosted on both HostGator and 1and1 and i get the same errors everywhere) - seems like
authentication problems.
the site is on ASP.NET 2.0 and these are the error msgs i get:
Error For google contacts (using AuthSub) - this happens after the I successfully receive a session token from google's authsub:
The remote server returned an error: (401) Unauthorized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an error: (401) Unauthorized.
Source Error:
Line 493: ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("default"));
Line 494:
Line 495: ContactsFeed feed = service.Query(query);
Line 496:
Line 497: ArrayList emails = new ArrayList();
Source File: d:\inetpub\vhosts\e-koren.com\httpdocs\home-cooking\EmailInvite.aspx.cs Line: 495
Error For youtube video uploading (using ClientLogin):
Invalid credentials
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: Google.GData.Client.InvalidCredentialsException: Invalid credentials
Source Error:
Line 71: // try
Line 72: // {
Line 73: FormUploadToken _token = request.CreateFormUploadToken(newVideo);
Line 74:
Line 75: actionURL.Value = _token.Url + "?nexturl=" + Server.UrlPathEncode(Request.Url.ToString()+"?uuc=");
Source File: d:\inetpub\vhosts\e-koren.com\httpdocs\home-cooking\youtubeUpload.aspx.cs Line: 73
Anyone knows what could it be?
Thanks,
Asaf
I managed to slove it eventually:
as for the first error (authsub and google contacts) - I changed the URI from "http" to "https":
// V1
GAuthSubRequestFactory authFactory = new GAuthSubRequestFactory("cp",gn.ytApplicationName);
authFactory.Token = (String)Session["token"];
ContactsService service = new ContactsService(authFactory.ApplicationName);
service.RequestFactory = authFactory;
ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("default"));
// VERY IMPORTANT! adding HTTPS resolves google's bug (401 error)
query.Uri = new Uri("https://www.google.com/m8/feeds/contacts/default/full");
ContactsFeed feed = service.Query(query);
about the 2nd error (ClientLogin) - appearantly google have tightened the security measures around this kind of method - they send a warning email to the user that I wanted to log in through - and only if he follows several complex steps they authorize access to his videos.
As I found out this is not an error, but a policy, I think I'll just switch to AuthSub there too.
Hope I could help someone else too...
:)

File.open file creation error

I'm trying to create a file using:
Dim stmFile As Stream = File.Open(filename, FileMode.OpenOrCreate, FileAccess.Write)
This should create a file as the file specified does not currently exist however instead it throws a server error:
Could not find a part of the path 'c:\tempemail\681968_File.doc'.
Description: An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and where
it originated in the code.
Exception Details: System.IO.DirectoryNotFoundException:
Could not find a part of the path 'c:\tempemail\681968_File.doc'.
Any advice?
Try the following
Ensure that the tempemail exists
Ensure that the application pool user has write permission to the folder.

Resources