Template ASP.NET with the React template on IIS - error 404 - c#

I built and published the application using this instruction: https://learn.microsoft.com/en-us/visualstudio/javascript/tutorial-asp-net-core-with-react?view=vs-2022
I used two projects: "React" and "API asp.net" Visual Studio templates.
Chose publish ASP.NET Core project to the folder. Moved the application to a local IIS server and created a website.
Before publishing, I corrected the URL of the 'target' parameter to React to the URL of the website. Perhaps there is a wrong action here.
As a result,
"http://localhost" response with code 404
"http://localhost/weatherforecast" response 200 with JSON
How to configure the application to run on the IIS server?
I'm trying to find material on this topic, but without results.

Related

How to Publish ASP.NET Web Application (.Net Framework) with Visual Studio to FTP Server?

I am trying to publish an ASP.NET Web Application (.Net Framework) to a subdomain on my webhotel. The problem is that when the site has uploaded and I visit the page, the site is not displayed, only the code in the index.cshtml file is shown in the browser. The site consists of Razor Pages.
I have checked the root directory for the subdomain at my webhotel and noticed that there are no .dll files which I was expecting there would be. What might the problem be and how can I solve this?
I have been informed by the support from the Webhotel Host that it is not possible to publish a Web Application to an ordinary FTP server. Instead I have found that Google Cloud Platform or equivalent, is needed to host a Web Application. The directory needs to be specifically prepared for a Web Application.

Published .NET app is looking for API in source folder

I'm new to API development and have created a Web API app that works fine locally (Visual Studio / IIS Express). When I publish and deploy to IIS 8.5, the HTML pages work fine, but when I make an ajax call to my APIs, I get a 500 error. It somehow seems to be looking at my source code folder on my c: drive!, instead of the dll.
I'm guessing I botched something in the VS Publish setting, or in my API routing in WebApiConfig.
Any idea on why it's looking in my source directory?
From what I can understand, is that your API is expecting custom header as part of your request. Please use PostMan or any other REST API Client to test your API by adding required headers. If you build and publish in release mode you will not find your local source code folder path.

Publish ASP.Net MVC application without .exe

After I publish my ASP.Net application using Visual Studio 2015 to my web host I get Access denied when I type the adress in the browser.
I called my web host support and asked why and he told me they don't allow .exe files, and there is .exe files inside my bin/roslyn folder.
How do I publish my project without the .exe files?
Update:
After reading the comments i found that my project is actually using Owin. I tried following these steps but when I try to uninstall Owin I get error: SignalR Core is dependent on Owin.
Is it not possible to use SignalR without self-hosting the web page with Owin?

Service not running on IIS 6.0 of Server because of http error 404.3 not found

i have two projects in a solution of asp.net c# web application. One of them is a .asmx service. I have added the reference of my service in my second project. I have published it and deployed it on my system on IIS 6. That works fine on my system. But when i deploy it on the IIS of server, It gives an error of "HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map."

Default mvc/webapi site works in IIS Express but not in IIS 7.5

I've googled and searched stackoverflow, the following were not helpful
RESTFul service works in IIS Express / VS2013 but not on IIS Server
- the hot fix when run says "The update is not applicable to your computer."
Different result in IIS express and IIS
- not running dotnetnuke or webmatrix
running Win7Pro, with IIS7.5 Have VS2013Pro udpate 3 installed, had VS14CTP installed but is now uninstalled.
Create a new project, chose Web Application, MVC+WebApi, have WebApi 2.2 installed via nuget.
Make no changes to app, hit F5, app starts in chrome, see default ASP.NET site with a link to home and api. Clicking the Api link takes you to a help page describing the api calls available.
Publish site to file system, create new IIS website, point site to published folder, add defaultAppPool user to folder. browse to site from within IIS Manager. Site displayes but no styles are displayed. Setup site as machinename:80 also tried machinename:50102. Not using SSL or any authentication.
In chrome console there are 3 errors (this does not happen in IISExpress)
Uncaught SyntaxError: Unexpected token < modernizr:1
Uncaught SyntaxError: Unexpected token < jquery:1
Uncaught SyntaxError: Unexpected token < bootstrap:1
Trying to navigate to the api link, just refreshes the page, the help page is not displayed.
Using fiddler to try to hit one of the services in IIS Express works as expected. Using fiddler to try to hit any of the servcies returns the default home page.
Please recall no changes made to code, just the default mvc+webapi solution created.
Checked application_start(), it contains
GlobalConfiguration.Configure(WebApiConfig.Register); as the second line.
Any help would be appreciated.
It basically comes down to how you created the solution. In visual studio 2013 Professional, File->New Project -> Visual C# -> Web -> ASP.NET Web Application Click OK. In the pop up under "Add folders and core refrences for:" MVC is checked and greyed out, you cannot un-select it. Check "Web API" check box, click ok. All will work fine while working in VS. However once published as release. Point IIS at published folder, if needed, navigate to page. Page loads but has errors as described above.
To avoid this, do not check the "Web API" check box when creating the new project. Add Web API to the solution after creating it, not during the creation.
VS version 12.0.31101.0 Update 4
.NET version 4.5.52747

Categories