asmx Web服务不适用于IIS Express

时间:2013-03-29 05:16:19

标签: asp.net .net web-services iis iis-express

我们正在开发人员计算机上从IIS 5.1迁移到IISExpress。我们有ASP .NET应用程序,它也托管一些.asmx webservices。 使用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映射 详细错误信息: 模块StaticFileModule 通知ExecuteRequestHandler 处理程序StaticFile 错误代码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>

2 个答案:

答案 0 :(得分:0)

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

How to install umbraco in root folder of the IIS server in localhost?

答案 1 :(得分:0)

我将requireAccess从'Read'更改为'Execute'以用于后续处理程序

<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 - 禁止
您试图从不允许运行可执行文件的目录运行CGI,ISAPI或其他可执行程序。

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