HTTP 404 error in simple test- IIS server - iis

I have this very elementary test working in computer A, but the same exact configuration is not working in computer B:
Using IIS, computer A is a Windows Server 2019, computer B is a Windows Server 2022
The configuration is:
Default Website (at the usual physical path c:\inetpub\wwwroot
At the server level, Server Certificates: there is a certificate (current, not expired)
At the website level:
SSL settings: Require SS is checked. Client Certificates: Accept
Edit Permisions>Security: IIS_USRS has all permissions
I have an application defined in IIS called bare that points to a physical path d:\local\bare
I have a test2.aspx page in the website root folder, which has 3 lines:
<html>
test2.aspx
</html>
Similarly, I have a test3.aspx page in the bare folder which has 3 lines:
<html>
test3.aspx
</html>
In computer A, both the page (test2.aspx) at the website root level, and the page (test3.aspx) at the bare app level are served fine:
https://computerA.mycompany.com/test2.aspx
https://computerA.mycompany.com/bare/test3.aspx
However, in computer B, when I do the same exact tests, i.e.:
https://computerB.mycompany.com/test2.aspx
https://computerB.mycompany.com/bare/test3.aspx
the second request give me a Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /bare/test3.aspx
What could the problem be?
Each test was conducted from the computer itself.

Related

Shopware 6 Unable to find a matching sales channel for the request

I have been stuck on this for long enough now, basically I am wanting to try and use Shopware 6 as a PWA.
To install shopware I make use of Valet and Git.
But I am never able to use install Shopware6 in the right way because I am always getting the same error:
This is how I am installing Shopware6:
clone git repo -->https://github.com/shopware/production;
cd /production;
-composer install (to install dependencies)
./bin/console system:setup - At this step I am asked to input some datas:
Application environment [dev]: //dev;
URL to your /public folder [http://localhost]: // http://production.test;
Blue Green Deployment (yes/no) [yes]: //yes
Database user [app]: //root
Database password: //root
Database host [localhost]: //
Database port [3306]: //
Database name [shopware]: //
Database SSL CA Path []: //
Database SSL Cert Path []: //
Database SSL Key Path []: //
Skip verification of the database server's SSL certificate? (yes/no) [no]: //no
Once Shopware 6 is installed I would visit production/public to create a valet link (virtual host).
valet link production.test
I visit my virtual host on http://production.test
At this moment I always get the above mentioned error: Unable to find a matching sales channel for the request: http://production.test/". Please make sure the domain mapping is correct.
This is a bit odd. Good news is that your installation seems to be working, but for some reason it sounds like your SalesChannel -> domain is not set. Try logging into http://production.test/admin & going to the Storefront sales channel. There you can configure the domain.
You can see it here as an example:

Website is not loading styles and files because is loading a different path

I just published my web app which has the following structure:
Project Name
StylesFolder
filename.css
anotherfile.css
JavaScriptFolder
bootstrap.js
Index.html
What I did was:
Adding a new WebSite in the server IIS with the path were I publish my WebApp (ex. C:\WebProjects\PublishedApp\Project Portal)
Selecting my published app and converting into an application (The alias name was Project Name and the physical path was C:\WebProjects\PublishedApp\Project Portal\Project Name)
The problem is when I try to see the website. I'm able to enter to 192.169.100.20:80/Project%Name/ and my index page is loaded (I can see the text, inputs, etc.) but I cannot see any stlye and javascript input and when I check the console logs all the files are getting a 404 error response.
When I check which URL is used by the files I can see that they are trying to get accessed by 192.169.100.20:80/Project Name/StylesFolder/filename.css etc...
So my question is what can I do to remove the /Project%Name/ string from the URL?
PD. I'm using IIS 7
When you add your website in IIS, select the application folder you published. For example, when you publish your application to D:\Program Files\Publish Folder, select the Publish Folder folder directly when adding the website and choose the physical path.
This is the reference:Deploy Website on IIS

IIS Virtual directory creates path issue

I am using VS 2013 and MVC5
To host the application in IIS, i have used Properties-> Web ->Servers ->Local IIS and clicked on Create Virtual directory.
So this created a VD for "MyPortal"
But now i have a path problem.
I have an api controller in my application.
When i was using VS development server it was being accessed using the url : localhost:1553/api/menuapi and the data was getting accessed correctly.
But once it is hosted to IIS, it stopped working.
When checked, it is trying to fetch the data from url i.e :
localhost/api/menuapi and it gives a 404 error.
But actually the api is fine and the data is accessible from the url :
localhost/MyPortal/api/menuapi
Why and how is this path problem created?
The below is how i am doing the api call :
1. In javascript file :
$http.get('/api/menuapi/' + menuid).success(function (data) {});
Please suggest if any alternatives.
The problem is that your javascript will only works if the application is deployed on the top level of the webserver (/), as you are using an absolute url.
If your javascript is executed at the top level of your application, you could just change your url as relative:
$http.get('api/menuapi/' + menuid).success(function (data) {});
but if your javascript in a view, a better approach would be to retrieve the proper full url with:
#Url.Content("~/api/menuapi/")
like:
$http.get('#Url.Content("~/api/menuapi/")' + menuid).success(function (data) {});

Swashbuckle running with katana-owin based web api doesnt work with IIS but works with IIS Express

I think I have a similar issue as this post-
Webactivator doesn't run on IIS 7
Swashbuckle running with katana-owin based web api is able to work with IIS Express.
assume all the urls below have an "http" prefix.
I can browse to something like localhost:8085/swagger Which redirects me correctly to localhost:8085/swagger/ui/index
But when published to IIS redirects to localhost/swagger/ui/index instead of localhost/myapp/swagger/ui/index and this results in a 404. Notice that even though an application name is specified while publishing somehow swashbuckle/swagger doesn't know and only uses the pathbase without the application name.
basically it just picks up the site root URL instead of the application URL that was used to call /swagger
Any solution to this problem?
I got the same issue. Solved this using the following code (c.RootUrl)
config.EnableSwagger(c =>
{
c.IncludeXmlComments(GetXmlCommentsPath());
c.SingleApiVersion("v1", "yourAPI");
c.RootUrl(req => req.RequestUri.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/").TrimEnd('/'));
});
Reference : Relative path for UI request URL

Deploy to azure then get 403 - Access Forbidden

I'm trying to deploy to Azure (Silverlight application); I've migrated my DB, updated connection strings and published my application to Azure but when I click the service URL I get this:
403 - Forbidden: Access is denied.
You do not have permission to view this directory or page using the credentials that you supplied.
Any idea what I need to change?
Many thanks
If the name of your bundle matches the path in the file system then IIS on Azure will throw the 403 Forbidden error.
So if you have a path in your solution called /Content/css and you have a bundle name called bundles.Add(new StyleBundle("~/Content/css").Include( ... in BundleConfig.cs which is displayed like this #Styles.Render("~/Content/css") in your _Layout.cshtml file. Then you get that error.
I solved this by changing the name of my bundle from /Content/css to /Style/css
bundles.Add(new StyleBundle("~/Content/css").Include( ... in BundleConfig.cs becomes bundles.Add(new StyleBundle("~/Style/css").Include( ...
#Styles.Render("~/Content/css") in your _Layout.cshtml becomes #Styles.Render("~/Style/css") in your _Layout.cshtml
You can use any names you like there is no specific limitations. I imagine you can go ahead and rename the folders in your solution too and that should work.
NB: The name of the bundle turns into a virtual directory that the browser can request from. If it resembles a physical folder structure then it will throw back the 403.
I needed to use the full path to a page within the application as I hadn't set a default document in my web config e.g
<add value="Pages/Home.aspx"/>
I got the same error in my MVC project.
After some debugging I found that it was because I have removed all "default pages" in the Azure Portal.
I added a dummy "index.html"-record in the portal and then everything worked nicely again :)

Resources