ASMX 服务在开发服务器上工作,部署到 IIS 7.5 时返回 404 [英] ASMX service works on development server, returns 404 when deployed to IIS 7.5

查看:51
本文介绍了ASMX 服务在开发服务器上工作,部署到 IIS 7.5 时返回 404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 ASP.NET 4.0 中有一个 Web 应用程序.我添加了一个 asmx 服务,主要是作为自动完成扩展程序查找值的来源.

当我在本地机器上调试时,一切正常.但是,当我将 Web 应用程序部署到 IIS 7.5 时,我在尝试向服务发送数据时收到 HTTP 404 响应.

我能够浏览到服务定义,查看可用的操作.然而,很明显,当我使用测试页面通过 POST 测试服务时,我再次收到 HTTP 404.

我不确定发生了什么.我确实在我的 Web 应用程序中创建了 asmx 文件,并将其部署在我的其他工作生产应用程序的虚拟目录中.

在同一虚拟目录中部署的 .asmx 文件是否存在问题?

解决方案

我刚刚遇到了同样的错误,在绊倒这个 SO 条目后:

处理程序在 IIS7.5 集成管道上返回 404 错误

ASMX 操作 404s,但是ASMX服务描述没有,url路由问题?

并尝试将 asmx 处理程序添加到 web.configs webServer 部分的解决方案一切正常:

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

I have a web application in ASP.NET 4.0. I've added an asmx service, primarily as a source for the autocomplete extender's lookup values.

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.

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.

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.

Is there an issue with the .asmx file being deployed in the same virtual directory, perhaps?

解决方案

I've just encountered the same error, after stumbling over this SO entry:

Handlers returns 404 error on IIS7.5 integrated pipeline and

ASMX operation 404s, but ASMX service description doesn't, url routing issue?

and tried the solution of adding the asmx handler to the web.configs webServer section all was well:


  <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>


这篇关于ASMX 服务在开发服务器上工作,部署到 IIS 7.5 时返回 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆