2011-08-16 30 views
36

IN VS 2008 è possibile eseguire .svc ma in produzione IIS 7 non è possibile. Ho ricevuto questo errore. sto usando la vittoria x64.Errore HTTP 404.17 - Non trovato

corro

C:\Windows\Microsoft.NET\Framework\v2.5.0.30319>aspnet_regiis.exe -i 
Start installing ASP.NET (4.0.30319). 
......................... 

e

C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -i 
The error indicates that IIS is not installed on the machine. Please install IIS 
Finished installing ASP.NET (2.0.50727). 

ma è lo stesso. Corro VS 2008. Pool di applicazioni: framweork NET è 2.0. E permetto a 32 bit applicazione

Error Summary 
HTTP Error 404.17 - Not Found 
The requested content appears to be script and will not be served by the static file handler. 
Detailed Error Information 
Module StaticFileModule 
Notification ExecuteRequestHandler 
Handler StaticFile 
Error Code 0x80070032 
Requested URL http://192.168.2.4:80/Service.svc 
Physical Path C:\inetpub\wwwroot\WebServices\Service.svc 
Logon Method Anonymous 
Logon User Anonymous 
Most likely causes: 

    The request matched a wildcard mime map. The request is mapped to the static file handler. If there were different pre-conditions, the request will map to a different handler. 

Things you can try: 

    If you want to serve this content as a static file, add an explicit MIME map. 

EDIT:

web.config

<?xml version="1.0"?> 

<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use 
    the Website->Asp.Net Configuration option in Visual Studio. 
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
--> 
<configuration> 
    <configSections> 
     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> 
     <section name="nhibernateSettings" type="ProjectBase.Data.NHibernateSessionMgmt.OpenSessionInViewSection, ProjectBase.Data" /> 
     <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
       <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
       <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
        <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> 
        <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
        <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
        <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
       </sectionGroup> 
      </sectionGroup> 
     </sectionGroup> 
    </configSections> 
    <appSettings> 
     <add key="NHibernateConfigPath" value="D:\PROJEKTI\WebServices\DotNet\WebServices\WebServices\NHibernate.config" /> 
    </appSettings> 
    <connectionStrings> 
     <add name="connectionString" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=WebServices;Data Source=.\SQL2008" providerName="System.Data.SqlClient" /> 
    </connectionStrings> 
    <nhibernateSettings> 
     <!-- List every session factory that will be needed; transaction management and closing sessions 
      will be managed with the open-session-in-view module --> 
     <sessionFactories> 
      <clearFactories /> 
      <sessionFactory name="WebCrawlerFactory" factoryConfigPath="D:\PROJEKTI\WebServices\DotNet\WebServices\WebServices\NHibernate.config" isTransactional="true" /> 
     </sessionFactories> 
    </nhibernateSettings> 
    <log4net> 
     <appender name="LogAllToFile" type="log4net.Appender.FileAppender"> 
      <file value="WebCrawler.log" /> 
      <appendToFile value="false" /> 
      <layout type="log4net.Layout.PatternLayout"> 
       <conversionPattern value="%d [%t] %-5l - %m%n%n" /> 
      </layout> 
     </appender> 
     <root> 
      <priority value="ALL" /> 
      <!-- ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF--> 
      <appender-ref ref="LogAllToFile" /> 
     </root> 
    </log4net> 
    <system.web> 
     <!-- 
      Set compilation debug="true" to insert debugging 
      symbols into the compiled page. Because this 
      affects performance, set this value to true only 
      during development. 
     --> 
     <compilation debug="true"> 
      <assemblies> 
       <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
       <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
      </assemblies> 
     </compilation> 
     <!-- 
      The <authentication> section enables configuration 
      of the security authentication mode used by 
      ASP.NET to identify an incoming user. 
     --> 
     <authentication mode="Windows" /> 
     <!-- 
      The <customErrors> section enables configuration 
      of what to do if/when an unhandled error occurs 
      during the execution of a request. Specifically, 
      it enables developers to configure html error pages 
      to be displayed in place of a error stack trace. 

     <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> 
      <error statusCode="403" redirect="NoAccess.htm" /> 
      <error statusCode="404" redirect="FileNotFound.htm" /> 
     </customErrors> 
     --> 
     <pages> 
      <controls> 
       <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
      </controls> 
     </pages> 
     <httpHandlers> 
      <remove verb="*" path="*.asmx" /> 
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" /> 
     </httpHandlers> 
     <httpModules> 
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     </httpModules> 
    </system.web> 
    <system.codedom> 
     <compilers> 
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
       <providerOption name="CompilerVersion" value="v3.5" /> 
       <providerOption name="WarnAsError" value="false" /> 
      </compiler> 
     </compilers> 
    </system.codedom> 
    <system.web.extensions> 
     <scripting> 
      <webServices> 
       <!-- 
       Uncomment this section to enable the authentication service. Include 
       requireSSL="true" if appropriate. 

      <authenticationService enabled="true" requireSSL = "true|false"/> 
      --> 
       <!-- 
       Uncomment these lines to enable the profile service, and to choose the 
       profile properties that can be retrieved and modified in ASP.NET AJAX 
       applications. 

      <profileService enabled="true" 
          readAccessProperties="propertyname1,propertyname2" 
          writeAccessProperties="propertyname1,propertyname2" /> 
      --> 
       <!-- 
       Uncomment this section to enable the role service. 

      <roleService enabled="true"/> 
      --> 
      </webServices> 
      <!-- 
     <scriptResourceHandler enableCompression="true" enableCaching="true" /> 
     --> 
     </scripting> 
    </system.web.extensions> 
    <!-- 
     The system.webServer section is required for running ASP.NET AJAX under Internet 
     Information Services 7.0. It is not necessary for previous version of IIS. 
    --> 
    <system.webServer> 
     <validation validateIntegratedModeConfiguration="false" /> 
     <modules> 
      <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     </modules> 
     <handlers> 
      <remove name="WebServiceHandlerFactory-Integrated" /> 
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     </handlers> 
    </system.webServer> 
    <system.serviceModel> 
     <services> 
      <service name="WebServices.Service" behaviorConfiguration="WebServices.ServiceBehavior"> 
       <!-- Service Endpoints --> 
       <endpoint address="" binding="wsHttpBinding" contract="WebServices.IService"> 
        <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
        <identity> 
         <dns value="localhost" /> 
        </identity> 
       </endpoint> 
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
      </service> 
     </services> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="WebServices.ServiceBehavior"> 
        <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
        <serviceMetadata httpGetEnabled="true" /> 
        <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
        <serviceDebug includeExceptionDetailInFaults="false" /> 
       </behavior> 
      </serviceBehaviors> 
     </behaviors> 
    </system.serviceModel> 
</configuration> 

risposta

45

avevo receievd un errore simile:

HTTP Error 404.17 - Not Found 
The requested content appears to be script and will not be served by the static file handler. 

ho provato lo stesso codice su diverse macchine. Attraverso alcuni R & D, ho finalmente trovato che la causa di ciò può essere che la mappatura WCF non è registrata con IIS.

Per risolvere l'errore precedente:

  1. Passare a "C: \ Windows \ Microsoft.NET \ Framework \ v3.0 \ Windows Communication Foundation " presso il comando di Visual Studio prompt dei
  2. Execute " servicemodelreg -i "per installare manualmente i mapping
1

There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined

O hai 2 nodi per <scriptResourceHandler> nel web.config, o il file .svc ha il proprio web.config e c'è un altro web.config nella stessa applicazione IIS che definisce <scriptResourceHandler>. Se si suppone che questo sia un sito autonomo annidato sotto un altro sito ASP.NET, sarà necessario crearlo come un'applicazione tramite lo strumento di amministrazione di IIS, ma senza sapere come sono strutturati il ​​tuo sito/le applicazioni, non posso offrire molto più aiuto.

+0

non ho 2 scriptResourceHandler e anche non 2 web.config – senzacionale

2

La mappatura WCF non è registrata con IIS.

Individuare C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation ed eseguire servicemodelreg -i installare manualmente

+3

Risposta duplicata della risposta accettata, ma con informazioni meno utili. –

75

enter image description here emissione è stato risolto attivando la comunicazione fondazione finestre -> HttpActivation sulla funzionalità di Windows.

+4

Doveva fare entrambe le Attivazioni 3.5 e 4.5 per qualche motivo. Grazie! – kampsj

+3

INFINE! Dopo aver reinstallato le cose un miliardo di volte, l'esecuzione di tutte le soluzioni di reg (aspnet_regiis e servicemodelreg) ... ha finalmente trovato il problema. In Windows 8, è disponibile in Funzionalità Windows -> Servizi avanzati di .NET Framework 4.5 -> Servizi WCF -> Attivazione HTTP Grazie mille! – Nullius

+0

+ 1. Ho lavorato anche per me. Grazie..!! –

1

Per le macchine Win7, la stessa impostazione può essere eseguita in Pannello di Conrol -> Programmi e funzionalità -> Attiva funzionalità di Windows on o off

enter image description here

0

sono appena stati in lotta con un servizio WCF BizTalk distribuito su IIS Windows Server 2012. E dopo aver provato Tutto il resto, ti è venuto in mente qualcos'altro, Pool di applicazioni. Se il pool di applicazioni è impostato su Modalità classica, è necessario avere httpHandlers sotto Controllo, devono essere definiti per tutti i tipi di file che si intende utilizzare. Se si esegue l'applicazione in modalità integrata, IIS si occuperà di ciò correttamente. Potrebbe essere buono per qualcuno che si ritrova qui dopo fare ricerche su Google.:)

-1

Ho dovuto aggiungere manualmente i mapping dei gestori per SVC NET 4.0. In qualche modo sono scomparsi dalla lista dei mapping di IIS.

Ho avuto l'idea HERE.

Problemi correlati