如何在 ASP.Net 中发布 Web 服务?

发布于 2024-10-15 01:41:03 字数 304 浏览 4 评论 0原文

以下网址是我托管的 Web 服务:http://monocept.net/vlt/html/AutoComplete。 asmx

当我调用此服务时,它会调用 Web 方法 GetCompleteList()。此方法实现在 AutoComplete.asmx.cs 文件中定义。当我调用此服务时,它会抛出 HTTP 404 异常,而在我的本地计算机中,服务工作正常并且能够调用 GetCompleteList() Web 方法。

Below url is web service which I hosted: http://monocept.net/vlt/html/AutoComplete.asmx

when I am invoking this service it calls web method GetCompleteList(). This method implementation is defined in AutoComplete.asmx.cs file. When I invoking this service it throws exception as HTTP 404, where as in my local machine service is working fine and able to hit GetCompleteList() Web method.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

丢了幸福的猪 2024-10-22 01:41:03

错误页面实际上是在 HTML 注释中转储异常/堆栈跟踪:

[HttpException]: The controller for path '/vlt/html/AutoComplete.asmx/GetCompleteList' was not found or does not implement IController.
   at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)
   at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

我不熟悉 MVC,所以我真的无法给你一个可靠的答案,但是研究该异常会发现一些 结果

The error page is actually dumping out the exception/stack trace in a HTML comment:

[HttpException]: The controller for path '/vlt/html/AutoComplete.asmx/GetCompleteList' was not found or does not implement IController.
   at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)
   at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I'm not familiar with MVC, so I really can't give you a solid answer, but researching that exception turns up a few results.

沫离伤花 2024-10-22 01:41:03

您尚未为此路径定义控制器。这是 MVC 错误。您的服务没有业务逻辑。

You haven't defined a controller for this path. It is MVC error. Your service doesn't has a business logic.

单身狗的梦 2024-10-22 01:41:03

您是否确保排除了 global.asax 文件中的路由?

routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");

Have you ensured that you are excluding the route in your global.asax file?

routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文