404 kein Fehler gefunden, wenn die Web -API lokal getestet wird

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: 404 kein Fehler gefunden, wenn die Web -API lokal getestet wird

by Anonymous » 14 Jul 2025, 15:02

Dies ist mein erstes Mal, dass ich versuche, die Web -API in einem Projekt zu verwenden, und habe keinen Erfolg damit ... < /p>

Ich bekomme immer wieder 404 Fehler, wenn ich versuche, meine API -Route im Geiger zu erreichen. />
Http 404 Seite nicht in Web -API gefunden, die in IIS 7.5 < /p>

Wenn jemand Bitte < /strong> helfen kann, dies zu erhalten, um die richtigen Einstellungen zu erhalten. />Web.config Datei: < /strong> < /p>

Code: Select all


































































http://miavsbremweb/arsys/services/ARService?server=miavsbremapp.ryder.com&webService=HPD_IncidentInterface_Create_WS




< /code>

Webapiconfig.cs Datei:  < /strong> < /p>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;

namespace FuelTicketImageRetrievalSvc
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services

// Web API routes
config.MapHttpAttributeRoutes();

config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
< /code>

global.asax.cs Datei: < /strong> < /p>

using FuelTicketImageRetrieval;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace FuelTicketImageRetrievalSvc
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
< /code>

 Controller -Methode, die ich anrufen möchte. Es ist nur eine Dummy -Methode, die einfach ohne Parameter Null zurückgibt. Der Name ist fuelticketimagereTrievalController: < /strong> < /p>

public string GetSpecificFuelTicket()
{
try
{
return null;
}
catch (Exception ex)
{
return null;
}
}
< /code>

Der Name meines Projekts heißt  fuelticketimageretrivievalsvc < /strong>. Ich habe durch die Webeinstellungen im Projekt, das IIS Express verwendet wird, verifiziert und wird auf < /p>

eingestellthttp://localhost:11581/
< /code>

 URL -Pfadanruf. < /strong> < /p>

http://localhost:11581/FuelTicketImageRetrievalSvc/api/GetSpecificFuelTicket

Top