Turn on https with SSL self signed certificate on local IIS environment

Possibly save 1 hour of your time: There are times when you have to set up your website during development to use https. Please see a reason from my previous article Chrome requires https for input text fields.

Create self signed certificate

  • Under IIS > select main instance > select Server Certificates in the middle pane
  • Right click and choose Create Self-Signed Certificate…
  • Enter friendly name for the certificate.

selfsignedcertificate.png

localtestingcertificate.png

Bind your site to the self signed certificate

  • Under IIS > Sites > select your website > on the right pane Actions select Bindings
  • On Site Bindings window > click Add
  • Add Site Binding

addsitebinding.png

That is it. You should be able to hit https on your website. You will still get unsecure message from the browser as it is not a real certificate.

IIS 10: Essentials for Administration (IT Pro Solutions)

Advertisements

Chrome requires https for input text fields

Possibly save 1 hour of your time: In October 2017, Chrome will be enforcing security warning for non https website that has input text fields. Your client may need to know this and decide to comply so their traffic will no face with not secure warning.

You will need to buy and bind the SSL certificate to your website.

See reference link for more details on how to setup for Azure website:

https://docs.microsoft.com/en-us/azure/app-service-web/app-service-web-tutorial-custom-ssl

Finally, you want to enforce https on your website so all HTTP requests will be redirect as a HTTPS request. One way to do that is through web.config but you will have to install URL Rewrite extension.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!-- BEGIN rule ELEMENT FOR HTTPS REDIRECT -->
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
<!-- END rule ELEMENT FOR HTTPS REDIRECT -->
</rules>
</rewrite>
</system.webServer>
</configuration>

C 6.0 and the .NET 4.6 Framework

Caching big data in application using MemoryCache

Possibly save 2 hours of your time: I have only encountered this more recently in an application that deals with big dataset.
In this scenario, the application needs to provide a feature to download full datasets. And this dataset is huge (~75MB to ~125MB) in size. And there are many datasets.
It took awhile to query this data and do some calculation and send it back to the client app. So we decide to cache this data at the application level using System.Runtime.Caching.MemoryCache for subsequent faster performance. As you can see, the problem can become bigger as more datasets are downloaded and cached.
There are few options in no particular order:
  1. More expensive but easiest solution may be to increase memory on physical server to account for the size of the cache that can grow to.
  2. Recycle the application pool after reaching maximum virtual memory usage. See here for specifics.
  3. Set the CacheMemoryLimit on the MemoryCache object. This sets the amount of memory on the computer, in bytes, that can be used by the cache.