Posted on

How to Deploy ASP.NET Core Web API on IIS Windows Server

(Tested on windows server 2012r2)

Install the .NET Core Hosting Bundle on Windows Server

The .NET Core Hosting bundle is an installer for the .NET Core Runtime and the ASP.NET Core Module. The bundle allows ASP.NET Core apps to run with IIS.

Current version:.NET Core Hosting Bundle installer (direct download)

(for this test we installed version .Net Core 8 on win 2012r2)

Visual Studio : Publish on Folder

After creating the ASP.NET Core application in Visual Studio, we can use the Visual Studio Publish Tool to deploy and run our app. For this project, choose to publish to a folder. Choose the folder and hit “Finish”.

In the next screen, where you see the settings for this deploy, click on “More Actions” and then on “Edit”.

Select :

  • Deployment Mode : Complete
  • Target Runtime : win-x64 (for our server)
  • File Publish Options : Delete all existing files prior to publish (flagged)
  • Database : Default Connection edit (if yuu need it)

Save this configuration, control it an Publish.

Copy the contents of the folder on the IIS server to the folder dedicated to the new site.

IIS and new site

Create the site on IIS. For the Application Pool you have to use default .NET CLR Version : v4.0.

Open your browser and call up the site. You receive the “page not found” error (404).

Remember that a site that hosts only calls web api. To verify that it works you can use the controller that Visual Studio sets by default when creating a site. Then type:

https://www.mynewapisite.com/WeatherForecast

and you will get a result. The site works!

Posted on

Deploy Xamarin Android App to Google Play Store

Xamarin App basic configuration

Visual Studio Configuration to Debug

AndroidManifest.xml

Open in editor xml (using Visual Studio)

android:debuggable=”true”

Project Propreties

  • Set use Fast Deployment (in the image below is not set)
  • Select apk


Visual Studio Configuration to Play store

AndroidManifest.xml

Open in editor xml (using Visual Studio)

android:debuggable=”false”

Project Propreties

  • Remove use Fast Deployment
  • Select bundle

Posted on

Mecdata – Website Development

MECDATA is an Italian company that offers a wide range of IT services, including website development and design. They have a team of experienced web developers who can create custom websites that meet the specific needs of their clients. MECDATA’s website development services include:

  • Website design and development: MECDATA can design and develop a website from scratch, or they can work with you to redesign an existing website.
  • E-commerce solutions: MECDATA can create an e-commerce website that allows you to sell your products or services online.
  • Content management systems (CMS): MECDATA can install and configure a CMS for your website, which will allow you to easily manage your website’s content.
  • Search engine optimization (SEO): MECDATA can help you optimize your website for search engines, so that it is more likely to be found by potential customers.
  • Website maintenance: MECDATA can provide ongoing maintenance for your website, so that it is always up-to-date and secure.

MECDATA’s website development services are affordable and reliable, and they have a strong track record of success. They are committed to providing their clients with high-quality websites that meet their specific needs.

If you are looking for a company to develop your website, MECDATA is a great option. They have the experience and expertise to create a website that will help you achieve your business goals.

Here are some of the reasons why you should choose MECDATA to develop your website:

  • Experience: MECDATA has a team of experienced web developers who have a proven track record of success.
  • Expertise: MECDATA has expertise in all aspects of website development, from design and development to SEO and maintenance.
  • Affordability: MECDATA’s website development services are affordable and competitive.
  • Reliability: MECDATA is a reliable company that is committed to providing its clients with high-quality websites.

Contact MECDATA today to get a free quote for your website development project.


Post written by Bart on 21/11/2023
Posted on

Retrieve resources in c# Windows Forms .Net Application

Scenario

You have a library (dll) with one or more image and you want to use those image in your application.

Load Resource from application

Consider having a library called : myLibrary.dll with some class inside with Namespace mylibrary.

In your bapplication you can get to the resources by referencing the assembly :

Assembly assem = Assembly.LoadFrom("myLibrary.dll");

You can enumerate the resource files

string[] resNames = assem.GetManifestResourceNames();
if (resNames.Length == 0)
Console.WriteLine(" No resources found.");

foreach (var resName in resNames)
Console.WriteLine(" Resource 1: {0}", resName.Replace(".resources", ""));
foreach (var resName in resNames)
Console.WriteLine(" Resource 2: {0}", resName);

And this will be the output :

Resource 1: myLibrary.Properties.Resources
Resource 2: myLibrary.Properties.Resources.resources

The replace is necessary because the real resource name is the first one (without .resources)

Now, If you have an image called myBitmap.png in your resources, you can load it, using ResourceManager

ResourceManager rm = new ResourceManager("myLibrary.Properties.Resources",
assem);

and finally

Object myres = rm.GetObject(myBitmap);

Load Resource inside Library

To get resource from a class inside your resource library, defined a new class, for example myClass and reference own assembly :

rm = new ResourceManager("myLibrary.Properties.Resources",
typeof(myClass).Assembly);

At this point you can withdraw the resource as seen above.

Posted on

Microsoft MFA : Enabled or Enforced

Multi Factor Authentication (MFA)

Microsoft recommends using multi factor authentication for global tenant administrators. If you don’t do this, 60 days after the last reminder from Microsoft, the tenant is deactivated.

Warning: it’s not enough to activate 2-factor authentication … you also have to use it.

Enabled or Enforced

The problem is that activation is not enough. In fact, after activating the user, he must also log in with the MFA: at this point the user’s status changes from Enabled to Enforced.

You don’t have to have Global Admin with MFA in Enabled status but only in Enforced status.