【问题标题】:WCF: HTTP 404.17 NOT FOUND after depyloing to local iisWCF:在 depyloing 到本地 iis 后未找到 HTTP 404.17
【发布时间】:2019-06-17 10:12:34
【问题描述】:

我在 WCF 中创建了一个安静的 Web 服务。如果我通过 Visual Studio 中的 IISExpress 托管它,一切都运行良好。但将其部署到本地 IIS 后,尝试访问 .svc 服务时出现 404.17 NOT FOUND 错误。 它指出: “未找到请求的内容似乎是脚本,不会由静态文件处理程序提供服务”

我已经尝试过这些解决方案:

启动命令提示符 - 开始 - cmd.exe cd C:\Windows\Microsoft.NET\Framework64[Dot Net Version] aspnet_regiis -ir 和 “C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation”并执行“servicemodelreg -i”手动安装。

这并没有改变任何东西。

我很确定这是一个配置问题,但由于我对此非常缺乏经验,所以无法弄清楚。

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
  </configSections>
  <appSettings/>
  <system.web>
    <compilation debug="true" targetFramework="4.6.2"/>
    <httpRuntime/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="webHttpServiceBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
      <service name="MyService.Service" behaviorConfiguration="ServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost/"/>
          </baseAddresses>
        </host>
        <endpoint binding="webHttpBinding" contract="MyService.IMyService" behaviorConfiguration="webHttpServiceBehavior"/>
      </service>
    </services>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb"/>
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
    </providers>
  </entityFramework>
  <connectionStrings>
    <add name="MyEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=localhost\myDB;initial catalog=DB;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient"/>
  </connectionStrings>
</configuration>

在尝试了几天后,我感到非常沮丧,因为在部署完全失败之前,开发这项服务真的很有趣。 我真的很感激任何提示。 谢谢!

【问题讨论】:

  • 您是否尝试过codeproject.com/Tips/882774/… 此处的步骤来删除 ISAPI 和 CGI​​ 限制?
  • “开发这项服务真的很有趣”。忽略 WCF 几乎已死,其他所有人都转向 ASP.NET Core Web API 的事实可能会很有趣。
  • @ClayVerValen 谢谢,今晚我会试一试。
  • @LexLi 仍然按预期工作(除了我的问题),所以我不太在乎。这也是我的第一个网络服务,所以我不太在意。不过感谢您的建议。

标签: c# asp.net wcf iis http-error


【解决方案1】:

解决了: 问题是我的 SQLSERVER 数据库没有配置 IIS APPPOOL 登录。 这是一步一步的解释:https://stackoverflow.com/a/7698316/7547137

【讨论】:

    猜你喜欢
    • 2020-05-14
    • 2014-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多