My HttpClient uses digest authentication to connect to the server and expects search queries in response. These search queries can come in any time so the client is expected to leave the connection open at all times. The connection is made using the following code: public static async void ListenForSearchQueries(int [...] read more
I am trying to generate an x509 certificate from a pair of keys generated with CngKey. I create the keys with: var parameters = new CngKeyCreationParameters { Provider = CngProvider.MicrosoftSoftwareKeyStorageProvider, ExportPolicy = CngExportPolicies.AllowPlaintextExport, KeyCreationOptions = CngKeyCreationOptions.OverwriteExistingKey, KeyUsage = CngKeyUsages.AllUsages, UIPolicy = new CngUIPolicy(CngUIProtectionLevels.None) }; var key = CngKey.Create(CngAlgorithm.ECDsaP384, container, parameters); [...] read more
I'm trying to setup a Web Server with Kestrel in ASP.Net Core 3.1 to support HTTP/2. So this is how I configure Kestrel: public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) { return Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseKestrel(options => { options.ListenLocalhost(8080, [...] read more
Doing some refactoring of some projects and I'm running into a resource issue that has me stumped. I'm having trouble loading resources from within a library. The same code runs fine within the main app (if I move the resource there of course.) Here's the app version that works... MyApp.csproj [...] read more
Relatively new to the windows ecosystem. After following the windows documentation on setting up a background application on iot and google's quickstart for C#, I am receiving this error that I cannot seem to solve: System.IO.IOException: 'Error loading native library "C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\BackgroundAppFirestoreOne-uwpVS.Debug_ARM.usernoname\grpc_csharp_ext.x86.dll". ' Stack Trace: System.IO.IOException HResult=0x80131620 Message=Error loading native library [...] read more
I observed the following exception while attempting to troubleshoot my original question: BadHttpRequestException: 'Bad chunk size data.' Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException HResult=0x80131620 Message=Bad chunk size data. Source=Microsoft.AspNetCore.Server.Kestrel.Core StackTrace: at Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException.Throw(RequestRejectionReason reason) The above exception occurred on my WebAPI controller. Client: let httpClient baseAddress = let handler = new HttpClientHandler() handler.AutomaticDecompression <- DecompressionMethods.GZip ||| [...] read more
lately I have encountered a following problem. Azure Function that is run in Visual Studio always throws an exception: > System.IO.IOException HResult=0x80131620 Message=Error loading native library > "C:\Users\\AppData\Local\AzureFunctionsTools\Releases\2.16.0\cli\grpc_csharp_ext.x86.dll" > Source=Grpc.Core StackTrace: at > Grpc.Core.Internal.UnmanagedLibrary..ctor(String[] libraryPathAlternatives) at > Grpc.Core.Internal.NativeExtension.LoadUnmanagedLibrary() at > Grpc.Core.Internal.NativeExtension.LoadNativeMethods() at > Grpc.Core.Internal.NativeExtension..ctor() at > Grpc.Core.Internal.NativeExtension.Get() at > Grpc.Core.GrpcEnvironment.GrpcNativeInit() [...] read more
The code i am using is simply for testing, here i test with gmail: C# code: private void button1_Click(object sender, EventArgs e) { string server = "smtp.gmail.com"; int port = 25; client = new TcpClient(); client.Connect(server, port); var stream = client.GetStream(); sslStream = new SslStream(stream); sslStream.AuthenticateAsClient(server); clearTextReader = new StreamReader(sslStream); [...] read more
I found the following similar SO answer that didn't fix my issue. I have a 5.0 console app and the HttpClient is being configured manually instead of using the Refit extension factory method (both ways result in the error). Console app config, previous attempt to use refit factory extension method. [...] read more
I have done this little piece of code on a console app, to stream a file or to simulate a stream of data over HTTP by chunk var musicFile = "music.mp3"; var imageFile = "image.mp3"; var prefixes = new List<string>() { "http://*:8888/" }; HttpListener server = new HttpListener(); foreach (string [...] read more
I am making DLL Injector and I am stuck in launching C#'s WPF Application from C++ code using the means described here: https://www.codeproject.com/Articles/416471/CLR-Hosting-Customizing-the-CLR This is my C++ code: #include <iostream> #include <Windows.h> #include <metahost.h> #include <mscoree.h> #pragma comment(lib, "mscoree.lib") int main() { HRESULT hr; ICLRMetaHost *pMetaHost = NULL; ICLRRuntimeInfo *pRuntimeInfo [...] read more
When i closing my application, FileStream sometimes throws IOException in the debug mode: System.IO.IOException HResult=0x80131620 Message=The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. This may cause data loss. Source=mscorlib StackTrace: at System.IO.FileStream.VerifyOSHandlePosition() at [...] read more