Unable to host Blazor application - iis

I am unable to get a Blazor app working while hosting the application as an IIS application on my local Windows 10 machine. The app is very simple, with just one page with minimal components - even simpler than the default Blazor app provided.
These are my steps:
Click on publish app
Select Folder, note it's going to ...\bin\Release\net5.0\browser-wasm\publish\
Open IIS, navigate to Default Web Site
Right-click Default Web Site and select Add Application
Select physical path as the path above, and host at www.NAME.com
Click Browse.. to view the app at www.NAME.com on *:80
Page displayed is the welcome page of IIS
Attempted Solution 1: Install URL Rewrite
Attempted Solution 2: Go to Hosts (in System32) and tried adding 127.0.0.1 or 127.0.0.1::80 followed by www.NAME.com
Attempted Solution 3: In index.html, edit the base element to include the link <base href="/NAME/" />
Attempted Solution 4: Instead of adding an application under Default Website in IIS, add it as a website instead
Attempted Solution 5: Gave IIS_IUSRS full permissions to web.config (Image)
None of the attempted solutions worked. I just started using Blazor yesterday and I am very new to this. Am I doing something wrong? Thank you!

Please refer to this tutorial, I think is one of the best tutorial to achieve your goals:
https://blog.medhat.ca/2020/08/deploy-client-side-blazor-web-api-to.html?m=1
Remember that the configuration of the hostname in your hosts file is related to your machine only
So, in order to allow the students to access your IIS published site you need:
Register a hostname in a DNS server that all the computer of the students will use to resolve your machine name. I.e. if your machine should be accessible with www.name.com you need your DNS server resolves this name with your local IP address
To use the https protocol you need a certificate on your local machine, loaded in your IIS configuration, but the same certificate has to be available to every computer of your students.
I think the better and simpler solution is to use your local machine name, probably using your full DNS name, and allows the students to access the site using this name on their browser.
In this case you can use your local development certificate to allow https connection
This certificate is already installed on your machine for development purpose.
Every concept I've described is well documented on the web and here on the SO.

Related

Website not working in IIS 7 using the IIS Manager

I have Microsoft Windows server 2008 R2 and have the IIS 7 running.
I have coded a web application on a seperate laptop and would like to publish it now on my server (serves as AD, DNS, File Server, IIS) that runs locally and has no external access. We will be using the application internally only.
I have followed the steps to install a website on IIS, however, it does not work. Below are the steps I have done.
Created a folder hierarchy and pasted the code files there. (check below image. The code files are inside wwwroot)
Create a new website from the IIS Manager as the below image.
The wwwroot folder has SYSTEM permission and it inherits the permissions from the parent. (Does it need to have other permissions?!?)
Whenever I visit the website, I get an error that the page is not found.
UPDATE
Upon #Ravi A's answer below, I have tried his steps as the below image, but the username is not found and the error persists.
Any ideas what is wrong?
windows iis website
You need to add a binding in your DNS i.e. ping mysite.local should resolve to the server IP, in your case since it's a intranet it should resolve to 192.168.1.253.
See here on how to do it. You need access to DNS Manager.
Also since you are not clear on DNS mapping leave the hostname empty and use machine name or IP to browse the site.

ReInstall Sitecore IIS can't resolve host (with ERR_NAME_NOT_RESOLVED)

I decided to reinstall Sitecore 8 instance via wizard, I have removed instance and install a new one with the same name XYZ.
but after reinstall it I am getting an error in browser - ERR_NAME_NOT_RESOLVED
I checked IIS binding, I checked hosts file, reset DNS, restart PC and etc I still get this error in any browsers.
How I can fix it? What is the issue?
I have found solution https://support.microsoft.com/en-us/kb/2823477 but I can't understend how sitecore installer can change it.
Generally, the process of site resolution goes in the following consequence:
DNS - find ip address by the hostname (from request header)
Access IIS with that IP (and port if not default 80)
IIS checks bindings by hostname from header and serves corresponding website.
Website being resolved has (merged) web.config in root folder. It has node with all sites served by current Sitecore instance, being listed. Order does matter! First successful match (by hostname or port or default) works it out.
Site being found on previous step has startItem property which is your Sitecore item served by dafault.
Please go and carefully check all those steps to see where it breaks. Also I have previously write a blog post, you may find it helpful with more details on that:
http://blog.martinmiles.net/post/how-websites-are-resolved-with-sitecore
Do any sites work with a Local name configured in 'hosts'?
You may need to disable the Loopback Check in your tcpip stack. Windows uses this as a countermeasure for man in the middle attacks by default on many systems. A registry change is needed to allow a machine to refer to itself using a name that is not its own Hostname. Sorry, but I can't remember the actual key.

Creating Web-Site and Web Application in IIS

Till date, I was thinking that we always create/host web-site in IIS.
But I was going through powershell tutorial today which says it is different to create web-site and a web application.
This is the tutorial link (check different section on creating web site and application) -
http://learn.iis.net/page.aspx/433/powershell-snap-in-creating-web-sites-web-applications-virtual-directories-and-application-pools/
Can please guide what is the difference between the two.
Any example will be really helpful.
Thank you!
A web site in IIS is the top level under Sites. The default one that is normally automatically created for you when installing IIS is named "Default Web Site".
This is the "root" that runs on port 80.
Under that, you can create virtual directories, which is basically sub-levels under the root web site, or you can create separate web applications that lives as separate applications under the root level.
A web application must live under a web site.
It is possible to create other web sites that can either be set up to run on other ports (i.e. 81), or to be named with a different host name which enables multiple sites to run on same port number. If named with a different host name, this name must be registered in a DNS server somewere to point to the IP address for your server. A workaround is also to to add it as an entry in the hosts file on the client computer that should access it.
This is example on how it looks in IIS Manager:
I have a script I use when creating a website and AppPool in IIS 7+, .net4, Integrated pipeline and thought you might find it useful.
Use it as so:
CreateSite.ps1 [WebsiteName] [AppPoolName] [Port] [Path]
If you are reinstalling the site, you will need to Stop it first. That is done as so:
StopSite.ps1 [WebsiteName] [AppPoolName]
you can grab the scripts from my gist
Update I have added/extended the scripts and put them in their own Github repository
Here is my CreateWebsite PowerShell script: http://www.zerrouki.com/create-website/

Configure IIS to access Deployed website globally (through WAN) [NOTE: I have static IP]

I am completely new bie to IIS.
I have a very basic knowledge about how to configure IIS.
Today I have a requirement to access website Globally through WAN (through internet from any PC all over world) which I have deployed in my Local IIS.
The website=> SilverLightBusinessApplicationWeb
which you can see in my below screen shot can be open in LAN nicely.
so I only looking for how to open it in WAN?
So anybody please suggest me a simple steps or instruction for it.
You can see two screen shot of Internet Information Service (IIS) Manager.
NOTE: 1. I also have static IP 2. i am using IIS7.0 with Windows-7
Thank you so much…..
1. Screen Shot1
2. Screen Shot2
This question is probably better off on ServerFault. However, providing you have everything set up on your machine, you just need to open and forward port 80 to your host machine and set up a domain or access the site directly via external IP providing your bindings are set up correctly.
EDIT From a security point of view, it would be better practice to do as Germann said by having your public facing web server in its own DMZ.
Finally i have got it........
the steps i have followed are......
define port forwarding at router for that i have enter following values in my router's forwarding page.
--IP address of my PC
--port number which is open(you can see screen shot Brouse*:80(http) which shows port 80
is open for website on my IIS.
finally i have opened website on my IIS by : .http://mystaticip:port/xyzfolder/xyz.html.

Setup local IIS7 for testing websites

Is there an alternative, other then modifying HOSTS to setup temp domains when testing websites locally? I'm using IIS7 on Win7.
I don't want to use /localhost/domainname. I'd rather do /domainname so i don't have to worry about paths to files, etc. My websites are setup so that paths to files are relative to the root folder and not to the page.
Unless your code explicitly checks the domain name, you should be able to deploy on II7 and test through http://localhost.
There are few caveats with this approach, though:
if you are using third-party API that requires a key tied to the domain name of you app, you might have to request two keys - one for the domain name (for PROD purposes) and one for localhost (for DEV purposes). I do that with both Google Ajax API and Facebook Connect keys.
http://localhost is in different security zone in IE than regular internet sites, so if your app uses any AP that requires cross-domain communication (like Facebook Connect), you might have problems testing on IE7. Works like a charm on Chrome and seems to work properly on IE8.
if you are working on multiple apps at the same time, you can't have all of them listen on port 80 at the same time. SO, some of the apps will have to be moved to http://localhost:8080 or another port.
My approach is to run the VS Dev WebServer (Cassini) on ports 808x during developing and to deploy to the local IIS7 (using CruiseControl.Net) on ports 888x. This allows me to debug easily with VS while working on the code, yet still have the site set under medium trust on IIS7.
I also have a host name on the target domain pointing to my dev machine, so the IIS7 instances are available both as http://localhost:888x and http://dev.domain.com:888x, which allows me to also test the domain integration with Google Ajax and Facebook Connect APIs. Of course, this requires control over the domain DNS and the ability to add an A record to it.
However, note that nothing in this setup requires actual testing on the domain URL.

Resources