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.
Related
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.
I am developing a .NET (not core) WEB API.
When I run it on mode debug in Visual Studio, and try to call the GET method of my API via Browser or Postman, it works fine!
But I am trying to publish it on my local IIS.
I published it via Visual Studio on a local folder. Created a website on IIS and made it point to the local folder.
When I try to open it on Browser, it just lists the files that are in the local folder. It doesnt execute my webAPI correctly.
Any insight on that?
After publishing a web app without errors from Visual Studio 2019 to an Azure web app, the website 404s and I can see in the console that there are only DLLs and an EXE in wwwroot - no aspx or html files. There are some scripts and CSS files in wwwroot/wwwroot.
What am I missing? I'm new to C#.NET, so it's probably something fundamental, but I haven't found an answer yet.
What would be deployed depends on your project's file structure.
If your web app runs successfully, don't mind about the content in wwwroot. If not, make sure your project could run successfully local, then deploy follow this tutorial: Quickstart: Deploy an ASP.NET web app
It turns out that the web app will 404 on lots of types of errors, in this case a problem connecting to the database. I was able to figure it out using Diagnostic Tools and the application error logs, so would recommend anyone else having unexplained 404s to check the logs. Pretty basic stuff, but as I said this is all new to me.
I have used Ubuntu to host websites in php before, but now I have created a C# VS API that I clicked my project and went to Publish and copied the files over to my /var/www/ directory thinking that it would be that simple for my api to launch. (of course I have apache installed and configured). However, when I navigate to the IP address instead of getting my API I generated I get a Index of / page showing the contents of the directory.
Is there a special setting needed in Ubuntu to be able to run an API? Did I not correctly generate the needed files from Visual Studio 2017?
I have a perfectly running asp.net c# application, i have windows 7, vs200, vs2010 and sqlserver2008r2 installed on my computer. I use vs2008 for my application. I use web deploy in release mode to generate a package and send it to an administrator to deploy the pack on a testing server. the deployed application works fine for some aspx pages but for some others pages it doesn't find them and displays an error message:
server eror in '/' application
the resource cannot be found
description: http 404. the resource you are looking for could have been removed...
requested url: /pagename.aspx
thank's for the help
ps: i do not have access or control over the testing server. the application was working fine before my first deploy.
The best explanation is that pagename.aspx isn't at the expected location.
Check if the file is there
If so, check if iis has the right directory for you webapplication
If not, make a correct deployment (do a test deployment on an clean directory).
Another hypothesis: It can happen if you are using svn and forgot to add unversion files to subversion.