简体   繁体   English

ASMX服务在开发服务器上运行,在部署到IIS 7.5时返回404

[英]ASMX service works on development server, returns 404 when deployed to IIS 7.5

I have a web application in ASP.NET 4.0. 我在ASP.NET 4.0中有一个Web应用程序。 I've added an asmx service, primarily as a source for the autocomplete extender's lookup values. 我添加了一个asmx服务,主要是作为自动完成扩展器的查找值的源。

When I debug on my machine locally, everything works fine. 当我在本地机器上调试时,一切正常。 However, when I deploy the web application to IIS 7.5, I get a HTTP 404 response when trying to send data to the service. 但是,当我将Web应用程序部署到IIS 7.5时,我在尝试将数据发送到服务时收到HTTP 404响应。

I am able to browse to the service definition, see the available operations. 我能够浏览到服务定义,查看可用的操作。 Tellingly, however, when I use the test pages to test the service using POST, I receive an HTTP 404 again. 然而,引人注目的是,当我使用测试页面使用POST测试服务时,我再次收到HTTP 404。

I'm not sure what is going on. 我不确定发生了什么。 I did create the asmx file within my web application and it is deployed in the virtual directory of my otherwise working production application. 我确实在我的Web应用程序中创建了asmx文件,它部署在我正在运行的生产应用程序的虚拟目录中。

Is there an issue with the .asmx file being deployed in the same virtual directory, perhaps? 是否存在将.asmx文件部署在同一虚拟目录中的问题?

I've just encountered the same error, after stumbling over this SO entry: 在遇到这个SO条目后,我刚刚遇到了同样的错误:

Handlers returns 404 error on IIS7.5 integrated pipeline and 处理程序在IIS7.5集成管道上返回404错误

ASMX operation 404s, but ASMX service description doesn't, url routing issue? ASMX操作404s,但是ASMX服务描述没有,url路由问题?

and tried the solution of adding the asmx handler to the web.configs webServer section all was well: 并尝试将asmx处理程序添加到web.configs webServer部分的解决方案一切都很好:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <add verb="*" path="*.asmx" name="asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
  </system.webServer>

You should check the application pool for the web service: 您应该检查Web服务的应用程序池:

  • Is it configured to use the correct .NET version 是否配置为使用正确的.NET版本
  • Check the identity 检查身份
  • Check the managed pipeline mode; 检查托管管道模式; some applications require Classic to be used 某些应用程序需要使用Classic

I was posting to asmx with jQuery and it worked in test systems, but failed on the production server. 我使用jQuery发布到asmx并且它在测试系统中工作,但在生产服务器上失败了。 I was missing the datatype parameter: 我错过了数据类型参数:

 $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", data: JSON.stringify({ //Data goes here }), dataType: "json", //<<<<<<<<< This is critical for the post to succeed in production. Without it we get a 404. url: "/yourPathHere/yourEndpoint.asmx/methodName", error: function (jqxhr, status) { //error handler }, success: function (data, status) { //succes handler } }); 

In Asp.net MVC RouteConfig.cs you can't have this line: 在Asp.net MVC RouteConfig.cs你不能拥有这一行:

routes.RouteExistingFiles = true; 

That was throwing me http 404 error. 那是在给我带来http 404错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试访问部署到IIS 7.5的Web API 2服务时出现404错误 - 404 Error when trying to access Web API 2 Service deployed to IIS 7.5 IIS express提供一个.asmx服务,但总是在另一个上返回404 - IIS express serves one .asmx service, but always returns 404 on another 我的asmx Web服务在本地工作,但在远程IIS 7上部署时不工作 - My asmx webservice works locally but not when deployed on remote IIS 7 /signalr/hubs 404 部署到本地 IIS 服务器时未找到,适用于 IIS express + signalr 1.0 - /signalr/hubs 404 not found when deployed to local IIS server, works on IIS express + signalr 1.0 Web服务(.asmx)在IIS 7中引发404错误 - Web Service(.asmx) is throwing 404 error in IIS 7 当部署到IIS 7.5上的子目录时,C#Web API 2应用程序在GET方法上生成404 - C# Web API 2 app generates 404 on GET method when deployed to sub directory on IIS 7.5 在IIS 7.5中托管时,ASP.NET Rest Service返回500错误,但在VS Debug Server中有效 - ASP.NET Rest Service returning 500 errors on return when hosted in IIS 7.5, but works in VS Debug Server 在框架中重定向时,IIS 7.5中出现404错误 - 404 error in IIS 7.5 when redirecting in a frame IISExpress 7.5出现内部服务器错误,而IIS 7.5起作用 - IISExpress 7.5 has Internal Server Error, whereas IIS 7.5 works IIS 7.5 MVC 5部署的网站将无法连接到SQL Server - IIS 7.5 MVC 5 deployed website will not connect to SQL Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM