asp.net - asmx Web 服务无法在 IISExpress 上运行

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

我们正在开发人员计算机上从 IIS 5.1 迁移到 IISExpress。我们有 ASP .NET 应用程序,它还托管一些 .asmx Web 服务。 使用 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 映射。
详细错误信息: 模块静态文件模块 通知执行请求处理程序 处理程序静态文件 错误代码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>

最佳答案

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

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

关于asp.net - asmx Web 服务无法在 IISExpress 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15697743/

相关文章:

c# - 使用 xml 以外的应用程序数据结构

c# - Ref 参数返回未知大小的数组。如何处理?

.net - .NET latex

c# - 通过 Internet 向开发人员发送应用程序错误和日志的最佳方式是什么?

web-services - 如何将Jasper REST API的输出更改为JSON而不是XML

java - html 服务器 grizzly+jersey(.jar 存档中的 .html)

c# - 填充 DropDownList

c# - 如何使用 c# asp.net 上传多张图片(从一个文件夹)?

c# - 如何在将数据集导出到 excel 时使标题字体加粗?

c# - 找不到存储过程 'dbo.aspnet_UsersInRoles_GetRolesForUser'