Posts

Common Net Core Issues when debugging a web app using IIS Express

Remote Access to Local ASP.NET Core Applications from Mobile Devices - Kloud Blog https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti Error: unable to connect to web server 'IIS Express' Solution: restart Visual Studio as Administrator Error: Bad host name when starting using http://localhost:xxx Solution:  Delete .vs folder (requires to close Visual Studio 2017) The ssl port is used. Please check launchSettings.json, set  "sslPort" to 0.  Error: This site can’t be reached when starting a SSL site Solution:  To fix self-signed certificate on the local machine you need to:  Delete .vs folder (requires to close Visual Studio 2017) Run these commands in cmd As Administrator: cd "C:\Program Files (x86)\IIS Express" IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:12345/ -UseSelfSigned Make sure you run VS2017 As Administrator and check if the issue addressed Note:...

Visual Studio 2019: Attached to Process not hitting break points for Net Core

Image
Cagri (Charlie) Aslan [MSFT] Aug 30, 2019 at 06:32 PM Can you check if you’ve used the correct debugger? i.e. Managed (CoreCLR) vs Managed (4.6)? You want the CoreCLR one to debug a coreclr app. https://developercommunity.visualstudio.com/content/problem/717375/debug-attached-to-process-not-hitting-break-points.html

Failed to Login Visual Studio 2019 with my Microsoft Account

Open Visual Studio Click Help > Send Feedback > Report a problem An instance of Visual Studio Feedback will open Attempt to sign in using your MS account If sign in is successful, check if you are signed into Visual Studio https://developercommunity.visualstudio.com/content/problem/70622/unable-to-login-into-visual-studio-2017-with-micro.html

Visual Studio 2019: Net Core Deployment Mode and Target Runtime

To avoid the weird 502.3 or other errors, please follow these rules: Deployment Mode Always select Self-contained except for Net Core 3.1 unless Net core 3.1 is installed on Windows Server  2012 R2+ (Net Core 3.1 requires 2012 R2+) Target Runtime Always select Win-x64. Though the "portable" option should work for all platforms, but it contains too many DLLs. Please check the publish profiles to make sure the profile is correct, e.g. no <_IsPortable>true</_IsPortable>. Sometimes the generated publish profile may not correct, please delete and re-create the profile. The recreation of publish profile is also suggested when Deployment Mode or Target Runtime is changed. Publish Mode Always use \\share instead of FTP. A lot of times using FTP can't correctly complete the deployment.

Using ReCaptcha v2 Insible in MVC Net Core 2 Applications

Suppose There is only one form in the page The form will be submitted in a way that can fire the the onsubmit event like either of the following: <input type="submit" value="Submit" /> <button type="submit">Submit</button> You can not submit a form in a way that can bypass the onsubmit event like the following (because the direct invocation of submit() will not fire the onsubmit event): <button type='button' onclick='getElementById("myForm").submit();'>Submit</button> The flow Clicking on submit -> Model client validation by jquery.validate -> reCaptcha client validation by grecaptcha.execute() -> (reCaptcha puzzle challenges if any) -> submitted by reCaptcha data-callback -> Model server validation -> reCaptcha server validation -> done Only after the reCaptcha client side validation has been passed, the form has chance to reach the back end. However, the ReCapt...

Using ReCaptcha v3 in MVC Net Core 2 Applications

/Views/Shared/_reCaptcha.cshtml @using Microsoft.Extensions.Configuration @inject IConfiguration _configuration <script src="https://www.google.com/recaptcha/api.js?render=@_configuration.GetSection('Recaptcha_v3')['SiteKey']"></script> grecaptcha.ready(function () { var $form = getForm(); if ($form.length == 0) { $(".grecaptcha-badge").hide(); } else { $form.on("submit", function(e){ e.preventDefault(); submitWithUserResponseToken($form); }); } }); function getForm() { return $("form").eq(0); } function submitWithUserResponseToken($form) { if ($form.length > 0) { grecaptcha.execute('@_configuration.GetSection("Recaptcha_v3")["SiteKey"]', { action: $form.attr('name') }).then ...

Learning GIT

Setting up a repository Version Controlling with Git in Visual Studio Code and Azure DevOps