WCF:解除对本地iis的解析后未找到HTTP 404.17

时间:2019-01-23 18:42:49

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

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

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

1 个答案:

答案 0 :(得分:0)

解决了它: 问题是没有为我的SQLSERVER数据库配置IIS APPPOOL登录。 以下是逐步说明:https://stackoverflow.com/a/7698316/7547137

相关问题