无法在IIS(Windows 10)上运行ASP.net服务-错误404(未找到) [英] Cannot run ASP.net service on IIS (Windows 10) - error 404 (not found)

查看:172
本文介绍了无法在IIS(Windows 10)上运行ASP.net服务-错误404(未找到)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是场景:Windows 10,VS2015更新3.

Here's the scenario: Windows 10, VS2015 update 3.

创建一个新的空白空" asp.net项目.NET 4.5.2,并添加一个虚拟"index.html". 使用IIS Express运行项目(默认设置):运行正常.

Create new blank 'empty' asp.net project, .NET 4.5.2, and add a dummy 'index.html'. Run project with IIS express (the default): runs fine.

将服务器更改为IIS:收到HTTP错误500.19-内部服务器错误,错误代码 0x80070021.这表明web.config中的模块"部分无效.因此,我注释掉该部分,然后再次运行.这会显示404错误.

Change server to IIS: get HTTP Error 500.19 - Internal Server Error, Error Code    0x80070021. This suggests an invalid section 'modules' in web.config. So I comment out that section and run again. That gives the 404 error.

我的JavaScript在IIS上运行良好,但是IIS似乎没有启动ASP.NET服务-对该服务的每次ajax调用都会导致错误404.因此,我猜想web.config中缺少某些内容.我在system.servicemodel中有这个

My JavaScript is working fine on IIS, but it appears that IIS is not starting the ASP.NET service - every ajax call to the service results in error 404. So I guess there's something missing from web.config. I have this in system.servicemodel

<services>
  <service behaviorConfiguration="ServiceBehavior" name="WebMap.WebMap">
    <endpoint address="" behaviorConfiguration="EndpBehavior" binding="webHttpBinding"
      contract="WebMap.IWebMap" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

和文件service1.svc组成

and the file service1.svc consists of

<%@ ServiceHost Language="C#" Debug="true" Service="WebMap.WebMap" CodeBehind="Service1.svc.cs" %>

注意:(1)两台不同的PC在做同一件事. (2)如果我创建一个新的"WebAPI"项目,而不是一个空"项目,则得到的结果完全相同,只是更多的部分需要从"web.config"中注释掉.

Notes: (1) two different PC's are doing the same thing. (2) if I create a new 'WebAPI' project, rather than an 'empty' one, I get exactly the same results, except that more sections need commenting out of 'web.config'

推荐答案

除了此处已回答的内容外

In addition to what is answred here IIS - this configuration section cannot be used at this path (configuration locking?) also add HTTP activation as shown below

这篇关于无法在IIS(Windows 10)上运行ASP.net服务-错误404(未找到)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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