3

我们正在开发人员机器上从 IIS 5.1 迁移到 IISExpress。我们有 ASP .NET 应用程序,它还托管一些 .asmx 网络服务。使用 IIS 5.1 时,我们可以使用以下 URL 访问 wsdl

http://localhost/MY_PATH/Service/WebServiceName.asmx?wsdl

但是,当我使用 IISExpress 时,我可以成功查看应用程序的所有页面,但是当我尝试查看 wsdl(http://localhost/MY_PATH/Service/WebServiceName.asmx?wsdl) 时,出现以下错误。

HTTP 错误 404.17 - 未找到 请求的内容似乎是脚本,不会由静态文件处理程序提供服务。最可能的原因:请求与通配符 mime 映射匹配。该请求被映射到静态文件处理程序。如果有不同的前置条件,请求将映射到不同的处理程序。您可以尝试的事情:如果您想将此内容作为静态文件提供,请添加显式 MIME 映射。
详细错误信息:Module StaticFileModule Notification ExecuteRequestHandler Handler StaticFile Error Code 0x80070032
请让我知道这里出了什么问题。以下是我的 applicationHost.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration> 
    <configSections>
        <sectionGroup name="system.applicationHost">
            <section name="applicationPools" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="configHistory" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="customMetadata" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="listenerAdapters" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="log" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="preloadProviders" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="sites" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="webLimits" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
        </sectionGroup>    

        <sectionGroup name="system.webServer">
            <section name="asp" overrideModeDefault="Deny" />
            <section name="caching" overrideModeDefault="Allow" />
            <section name="cgi" overrideModeDefault="Deny" />
            <section name="defaultDocument" overrideModeDefault="Allow" />
            <section name="directoryBrowse" overrideModeDefault="Allow" />
            <section name="fastCgi" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="globalModules" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="handlers" overrideModeDefault="Deny" />
            <section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="httpErrors" overrideModeDefault="Allow" />
            <section name="httpLogging" overrideModeDefault="Deny" />
            <section name="httpProtocol" overrideModeDefault="Allow" />
            <section name="httpRedirect" overrideModeDefault="Allow" />
            <section name="httpTracing" overrideModeDefault="Deny" />
            <section name="isapiFilters" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
            <section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
            <section name="odbcLogging" overrideModeDefault="Deny" />
            <sectionGroup name="security">
                ...
            </sectionGroup>
            <section name="urlCompression" overrideModeDefault="Allow" />
            <section name="validation" overrideModeDefault="Allow" />
            <sectionGroup name="webdav">
                <section name="globalSettings" overrideModeDefault="Deny" />
                <section name="authoring" overrideModeDefault="Deny" />
                <section name="authoringRules" overrideModeDefault="Deny" />
            </sectionGroup>
            <sectionGroup name="rewrite">
                ...
            </sectionGroup>
        </sectionGroup>
    </configSections>

    <configProtectedData>
        <providers>
            ...
        </providers>
    </configProtectedData>

    <system.applicationHost>

        <applicationPools>
            <add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />
            ...
            <add name="IISExpressAppPool" autoStart="true" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" /> 
            <applicationPoolDefaults managedRuntimeLoader="v4.0">
            </applicationPoolDefaults>
        </applicationPools>

        <listenerAdapters>
            <add name="http" />
        </listenerAdapters>

        <sites>
            <site id="1" name="MySite"  serverAutoStart="true">
                <application path="/" >
                    <virtualDirectory path="/" physicalPath="C:\MyProject" />
                    <virtualDirectory path="/MY_PATH" physicalPath="C:\MyProject" />
                </application>
                <bindings>
                    <binding bindingInformation=":8080:localhost" protocol="http" />
                </bindings>
            </site>
            <siteDefaults>
                <logFile logFormat="W3C" directory="C:\app_tmp\IISExpress\iWin7.0\Logs" />
                <traceFailedRequestsLogging directory="C:\app_tmp\IISExpress\iWin7.0\Trace" enabled="true" maxLogFileSizeKB="1024" />
            </siteDefaults>
            <applicationDefaults applicationPool="Clr2ClassicAppPool" /> 
            <virtualDirectoryDefaults allowSubDirConfig="true" />
        </sites>    
        <webLimits />    
    </system.applicationHost>

    <system.webServer>
        <serverRuntime />    
        <asp scriptErrorSentToBrowser="true">
            <cache diskTemplateCacheDirectory="%TEMP%\iisexpress\ASP Compiled Templates" />
            <limits />
        </asp>    
        <caching enabled="true" enableKernelCache="true">
        </caching>

        <cgi />

        <defaultDocument enabled="true">
            <files>
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />
                <add value="default.aspx" />
            </files>
        </defaultDocument>

        <directoryBrowse enabled="false" />

        <fastCgi />

        <globalModules>
            ...              
        </globalModules>

        <httpCompression directory="%TEMP%\iisexpress\IIS Temporary Compressed Files">
            <scheme name="gzip" dll="%IIS_BIN%\gzip.dll" />
            <dynamicTypes>
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="application/x-javascript" enabled="true" />
                <add mimeType="*/*" enabled="false" />
            </dynamicTypes>
            <staticTypes>
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="application/x-javascript" enabled="true" />
                <add mimeType="application/atom+xml" enabled="true" />
                <add mimeType="application/xaml+xml" enabled="true" />
                <add mimeType="*/*" enabled="false" />
            </staticTypes>
        </httpCompression>

        <httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
            <error statusCode="401" prefixLanguageFilePath="%IIS_BIN%\custerr" path="401.htm" />
            ...
            <error statusCode="502" prefixLanguageFilePath="%IIS_BIN%\custerr" path="502.htm" />
        </httpErrors>

        <httpLogging dontLog="false" />

        <httpProtocol>
            <customHeaders>
                <clear />
                <add name="X-Powered-By" value="ASP.NET" />
            </customHeaders>
            <redirectHeaders>
                <clear />
            </redirectHeaders>
        </httpProtocol>

        <httpRedirect enabled="false" />

        <httpTracing>
        </httpTracing>

        <isapiFilters>
            <filter name="ASP.Net_2.0.50727.0" path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="bitness32,runtimeVersionv2.0" />
            <filter name="ASP.Net_2.0_for_v1.1" path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="runtimeVersionv1.1" />
            <filter name="ASP.Net_4.0_32bit" path="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll" enableCache="true" preCondition="bitness32,runtimeVersionv4.0" />
        </isapiFilters>

        <odbcLogging />

        <security>    
            <access sslFlags="None" />    
            <applicationDependencies>
                <application name="Active Server Pages" groupId="ASP" />
            </applicationDependencies>    
            <authentication>    
                <anonymousAuthentication enabled="true" userName="" />    
                <basicAuthentication enabled="false" />    
                <clientCertificateMappingAuthentication enabled="false" />    
                <digestAuthentication enabled="false" />    
                <iisClientCertificateMappingAuthentication enabled="false">
                </iisClientCertificateMappingAuthentication>
                <windowsAuthentication enabled="false">
                    <providers>
                        <add value="Negotiate" />
                        <add value="NTLM" />
                    </providers>
                </windowsAuthentication>

            </authentication>

            <authorization>
                <add accessType="Allow" users="*" />
            </authorization>

            <ipSecurity allowUnlisted="true" />

            <isapiCgiRestriction notListedIsapisAllowed="true" notListedCgisAllowed="true">
                <add path="%windir%\Microsoft.NET\Framework\v4.0.30319\webengine4.dll" allowed="true" groupId="ASP.NET_v4.0" description="ASP.NET_v4.0" />
            </isapiCgiRestriction>

            <requestFiltering>
                <fileExtensions allowUnlisted="true" applyToWebDAV="true">
                    <add fileExtension=".asa" allowed="false" />
                    <add fileExtension=".asax" allowed="false" />
                    <add fileExtension=".ascx" allowed="false" />
                    ...
                    <add fileExtension=".rules" allowed="false" />
                </fileExtensions>
                <verbs allowUnlisted="true" applyToWebDAV="true" />
                <hiddenSegments applyToWebDAV="true">
                    <add segment="web.config" />
                    <add segment="bin" />
                    <add segment="App_code" />
                    <add segment="App_GlobalResources" />
                    <add segment="App_LocalResources" />
                    <add segment="App_WebReferences" />
                    <add segment="App_Data" />
                    <add segment="App_Browsers" />
                </hiddenSegments>
            </requestFiltering>

        </security>

        <serverSideInclude ssiExecDisable="false" />

        <staticContent lockAttributes="isDocFooterFileName">
            ...
            <mimeMap fileExtension=".application" mimeType="application/x-ms-application" />
            ...
        </staticContent>

        <tracing>

             <traceProviderDefinitions>
                <add name="WWW Server" guid="{3a2a4e84-4c21-4981-ae10-3fda0d9b0f83}">
                    <areas>
                        <clear />
                        <add name="Authentication" value="2" />
                        <add name="Security" value="4" />
                        <add name="Filter" value="8" />
                        <add name="StaticFile" value="16" />
                        <add name="CGI" value="32" />
                        <add name="Compression" value="64" />
                        <add name="Cache" value="128" />
                        <add name="RequestNotifications" value="256" />
                        <add name="Module" value="512" />
                        <add name="Rewrite" value="1024" />
                        <add name="FastCGI" value="4096" />
                    </areas>
                </add>
                <add name="ASP" guid="{06b94d9a-b15e-456e-a4ef-37c984a2cb4b}">
                    <areas>
                        <clear />
                    </areas>
                </add>
                <add name="ISAPI Extension" guid="{a1c2040e-8840-4c31-ba11-9871031a19ea}">
                    <areas>
                        <clear />
                    </areas>
                </add>
                <add name="ASPNET" guid="{AFF081FE-0247-4275-9C4E-021F3DC1DA35}">
                    <areas>
                        <add name="Infrastructure" value="1" />
                        <add name="Module" value="2" />
                        <add name="Page" value="4" />
                        <add name="AppServices" value="8" />
                    </areas>
                </add>
            </traceProviderDefinitions>

            <traceFailedRequests>
                <add path="*">
                    <traceAreas>
                        <add provider="ASP" verbosity="Verbose" />
                        <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
                        <add provider="ISAPI Extension" verbosity="Verbose" />
                        <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,Rewrite" verbosity="Verbose" />
                    </traceAreas>
                    <failureDefinitions statusCodes="200-999" />
                </add>
            </traceFailedRequests>

        </tracing>

        <urlCompression />

        <validation />
        <webdav>
            <globalSettings>
                <propertyStores>
                    <add name="webdav_simple_prop" image="%IIS_BIN%\webdav_simple_prop.dll" image32="%windir%\syswow64\inetsrv\webdav_simple_prop.dll" />
                </propertyStores>
                <lockStores>
                    <add name="webdav_simple_lock" image="%IIS_BIN%\webdav_simple_lock.dll" image32="%windir%\syswow64\inetsrv\webdav_simple_lock.dll" />
                </lockStores>

            </globalSettings>
            <authoring>
                <locks enabled="true" lockStore="webdav_simple_lock" />
            </authoring>
            <authoringRules />
        </webdav>

    </system.webServer>
    <location path="" overrideMode="Allow">
        <system.webServer>
            <modules>
                ...
            </modules>
            <handlers accessPolicy="Read, Script">
                ...
                <add name="WebServiceHandlerFactory-ISAPI-4.0_32bit" path="*.asmx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
                ...
                <add name="SimpleHandlerFactory-Integrated" path="*.ashx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.SimpleHandlerFactory" preCondition="integratedMode" />
                ...
                <add name="WebServiceHandlerFactory-Integrated" path="*.asmx" verb="GET,HEAD,POST,DEBUG" type="System.Web.Services.Protocols.WebServiceHandlerFactory,System.Web.Services,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" preCondition="integratedMode,runtimeVersionv2.0" />
                ...
                <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
            </handlers>
        </system.webServer>
    </location>
</configuration>
4

2 回答 2

0

您可能没有在 IIS express 中安装静态内容角色。请参阅此问题和答案以了解类似的问题/解决方案,看看它是否对您有帮助:

如何在 localhost 的 IIS 服务器的根文件夹中安装 umbraco?

于 2013-03-29T05:26:12.450 回答
0

我将以下处理程序的 requireAccess 从“读取”更改为“执行”

<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Execute" />

我现在在访问时收到以下错误

http://localhost:8080/MY_PATHJ/Service/ServiceName.asmx?wsdl 

HTTP 错误 403.1 - Forbidden
您试图从不允许运行可执行文件的目录运行 CGI、ISAPI 或其他可执行程序。

我所有的 .aspx 页面仍然可以正常工作。

于 2013-03-30T05:51:48.953 回答