Deploying ASP.NET Core 6.0 MVC app to Server doesn't work - iis

I am new to web development, I am learning it on the way as I develop my application.
I have an ASP.NET Core 6 MVC app that basically does this:
Starts with a Login
After login you can view the data
You can manipulate data on the view page
You can view some logs, and acknowledge them
So, my app works just fine when I run it from VS 2022.
I would like to deploy the app, so it can be used within the company. It all works on an internal network.
I have two options for deployment and to host the app from:
Windows Server 2019 (IIS)
Synology NAS
It really doesn't matter for me, but I have been through more than a dozen of tutorials/videos, but could not get it work either way.
I have tried different publishing methods.
I have .NET Core Hosting 7.0.2 and Web Deployment installed on the Windows server.
Basically my published file structure doesn't look like in some of the tutorials.
The furthest I've got is that I can load the page on the Windows Server 2019 machine, it shows the login page, but after I press "Login" it says ".../LoginController" Page not found.
So, after this chaos, can anyone give me some guidance where should I look for the solution? I thought it would be a good idea to use MVC, but now I think it would be much easier with a simple ASP Web app...

Eventually, after I got to the Login page (as I mentioned), I figured out the problem there. I am using cookies, which were set to "secure" in the program, but I was usint http instead of https. As a test, I have set the cookies' "Secure" property to "false", after that it worked.
At least I know where to go next.

Related

How to know web app framework by looking at the source code

I am more towards to infrastructure but want to learn web app.
I have been given access to Windows server + IIS, how do I know what web framework or even just what language of this web app? Thanks
install "Wappalyzer" browser extension
The extension automatically checks pages you visit and reveals the technologies the website is built with.

Progressive web app with asp.net core 2.0 Razor Pages

I want to create a progressive web app with ASP.NET CORE 2.0 using Razor Pages preferably because I like the code behind architecture of Razor Pages.
Please recommend me a tutorial or docs or any course where I can begin to learn this. I already know ASP.NET CORE so I don't need to learn that, but actually I want to learn and create PWA but at server side I want to use ASP.NET CORE 2.0 and Razor Pages (if possible). And then I will be hosting them in Azure.
The courses I've searched so far on the web, all of them are with node.js or any other server side technology. Which is a problem because I don't want to use JS, except on the front end, where I don't have a choice.
According to your description, I assume that you could refer to the following tutorials for getting started with PWA using .NET Core:
Yeoman PWA Angular 4 & .NET Core
PWA-Asp.NetCore
Building Progressive Web Applications (PWA) with Visual Studio
This is a very common misconception...that the client-side is tightly coupled to the server-side. They are not.
Your ASP.NET application renders pages/html on demand, at run-time, on the server. The site will work with or without the client-side code, that is why it is progressive....
Your PWA/Service Worker code is only concerned with stuff in the browser. You need to think about it as a stateless concern on the client. The service worker can add a proxy layer to the client-side where you can cache and really perform the task ASP.NET or Node Or PHP, etc perform, just in the browser, before the network must be used.
My advice, to learn the concepts, is to create a static version of your site or a test site. Get comfortable with how to make a PWA and a simple caching service worker, then apply it to your ASP.NET site.
There is nothing in ASP.NET itself your service worker needs to know about, well short of your routes. And your routes are independent of ASP.NET.

Web API 2 project and MVC 5 Website project in same domain

Technologies used:
BreezeJS
OData
Web API 2
MVC 5
IDE: Visual Studio 2013
I've been wrestling with the idea of having a Web API project and a separate web site project in a single solution.
My Web API 2 project opens up as: localhost:2020/ExampleProject.API
My MVC 5 WebSite project opens up as: localhost:5050/ExampleProject.WebSite
Now by default web api doesn't allow cross origin policies. So I played around with enabling CORS in my Web API 2, although I was able to get it to work, it only works for the latest browsers; I need the backward compatibility of IE7 to IE9.
So I played around with JSONP. I'm not fond of the lack of support that exists for this. I was able to get it to work for my Web API 2 project, but it doesn't work if I wanted to use BreezeController if using the breezejs web api library. It also doesn't work if I wanted to create an ODataController.
So I'm moving away from the idea of cross origin sharing; though hoping that in the future there will be enough support for jsonp regardless if I use BreezeJS WebAPI helper or ODataControllers.
For now, I have no idea how to put my WebAPI project and my MVC 5 Website under the same domain where I can have:
localhost/ExampleProject.API
localhost/ExampleProject.WebSite
Do I have to make some configuration in my host file? if I want to run my projects from VS2013 would it be able to run both projects under the same domain.. or do I have to keep on manually changing the URL in the browser?
Well, the answer was really really simple.
I know this an old question, it was just that I forgot how to do it since it's been so long since I did this. Searching for the answers on google and on stackoverflow was difficult since the discussions talked about setting up cross origin policies instead of setting up a same origin policy.
I spent the good portion of my time putting everything on IIS.
Created a website and had it point to the physical path where my website csproj and bin folder is located. I gave it a hostname of "dev.example.com" and changed my hostfile for 127.0.0.1 to refer to dev.example.com
Created a Web Application for the website, and set it up for web api 2 project. Everything magically worked after that.
The dumb part was, I could have easily done this in visual studio. I remember in VS2010, this cause many problems, but in 2013, I guess bugs have been fixed and it works now.
I had my WebSite project set up as
localhost:2020/ExampleProject.WebSite (incorrect)
instead of
localhost:2020 (correct)
and created a virtual directory. I do this by right clicking the project, going to properties, under "Web" tab.
So basically, the rule of thumb was to get my website to be my main root domain, and to copy that full domain to any web application I want to add under it.
So: website would be:
localhost:2020
web application:
localhost:2020/ExampleProject.API

MVC 4 Web Api Route 404 issue

I have a plain-vanilla MVC 4 Web Api project created using VS2012.
The (/api/Values) works out-of-the-box on the localhost but NOT when deployed on IIS (packages created using the standard "Publish..." from the project menu).
After been through lot of articles and reading suggestion for similar issue I found the Route tester which visualized how IIS was interpreting the request.
As the screenshot revels, the IIS is interpreting ~/api/values as ~/api/values.aspx
Any input on why this is happening and suggestion on how to resolve it is highly appreciated.
Thanks a lot for the help.

Microsoft Lync Server integration as a portlet

I came up with an idea to integrate Lync Server as a Java portlet to Liferay environment. What I would like to have is people names, photos, presence information and contact points on a portlet which communicates the data from Lync server.
(With contact point I mean those direct Voip or IM communications integrations that I suppose belong to the Lync concept.)
I don't know if there exist any ready integrations and if not, what material could be found about APIs and stuff like that so that I could probably code one of my own.
Thanks for interest and tips already beforehand!
I'm no Liferay expert, but i'm guessing Web Based Portal - right? If so, then yes, you can do what you need to.
Are you running the Lync client on the machines? if not, then you'll need to build some server infrastructure.
First step would be to download and install the UCMA 3.0 SDK.
At the back end, you would need to build a UCMA application that logs on to your Lync environment - the process of building and deploying is fairly lengthy, but described well here
You'd also need to build in a web service layer, so you can expose methods over the web, e.g. GetContacts, etc. The methods behind your web service would need to call into the UCMA app to fetch the required information.
Then you'd just need to build the necessary html and javascript to call the web services.
There is a codeplex project that does some of this - at the very least, it would be a great starting point
The whole thing is a lot easier if you are running Lync on the client, and if Silverlight is an option.
You'd need to download the Lync SDK. This contains a bunch of Silverlight controls that allow the user to e.g. see contact details, see a contacts availability, click to call etc. It would then just be a case of creating a Silverlight app using the controls, and then wrapping this inside a portlet.
Edit: George Durzi and Michael Greenlee's book is great for getting started with this, whichever route you go down.

Resources