Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 试图修复旧的Web服务_C#_.net_Web Services_Iis 7_Asmx - Fatal编程技术网

C# 试图修复旧的Web服务

C# 试图修复旧的Web服务,c#,.net,web-services,iis-7,asmx,C#,.net,Web Services,Iis 7,Asmx,我有一个旧的web服务项目需要快速修复 我知道这不是WCF,但这是很久以前写的,人们已经不在这里了。管理Web服务器的人不知道这个问题,我也被卷入其中 代码在调试模式下工作,例如在本地主机上,但live项目返回此错误 HTTP错误500.19-内部服务器错误 无法访问请求的页面,因为该页面的相关配置数据无效 详细错误信息: 模块iiswebcore 通知未知 处理程序尚未确定 错误代码0x800700b7 配置错误定义了重复的“system.web.extensions/scripting/sc

我有一个旧的web服务项目需要快速修复

我知道这不是WCF,但这是很久以前写的,人们已经不在这里了。管理Web服务器的人不知道这个问题,我也被卷入其中

代码在调试模式下工作,例如在本地主机上,但live项目返回此错误

HTTP错误500.19-内部服务器错误 无法访问请求的页面,因为该页面的相关配置数据无效

详细错误信息: 模块iiswebcore 通知未知 处理程序尚未确定 错误代码0x800700b7 配置错误定义了重复的“system.web.extensions/scripting/scriptResourceHandler”节 配置文件\?\D:\inetpub\wwwroot\xxxx.co.uk\u webservice\http.demo\web.Config 请求的URL 物理路径
登录方法尚未确定 尚未确定登录用户

配置源: 6: 7: 8:

web.config文件将此作为其内容

<?xml version="1.0"?>
<configuration>

    <configSections>
      <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>  
   <connectionStrings>
    <add name="APIDatabase" connectionString="SERVER=SERVER2;DATABASE=DB1;uid=LOGON;pwd=PSW;" providerName="System.Data.SqlClient" />
    <add name="Scotland" connectionString="SERVER=SERVER1;DATABASE=DB2;uid=LOGON;pwd=PSW" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="SERVER" value="SERVER1" />
    <add key="DEMOSERVER" value="SERVER2" />
    <add key="LIVESERVER" value="SERVER1" />
    <add key="ServiceURL" value="http://www.myservice.com/" />
  </appSettings>
    <system.web>

        <customErrors mode="Off"/>

        <compilation debug="true" >
          <assemblies>
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          </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"/>
          <add tagPrefix="asp" namespace="System.Web.UI.WebControls" 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>
    <!-- 
        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>
        <remove name="ScriptModule" />
        <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </modules>
      <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <remove name="ScriptHandlerFactory" />
        <remove name="ScriptHandlerFactoryAppServices" />
        <remove name="ScriptResource" />
        <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>
    <runtime>
      <assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
          <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
          <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
      </assemblyBinding>
    </runtime>

</configuration>

我看不到重复的scriptresource部分,因此我不知道发生了什么错误

同一文件夹中还有2个其他配置文件 Web.Release.Config Web.Debug.Config

但它们几乎没有任何XML


它指的是什么样的重复XML以及如何快速解析它。我刚刚复制了在调试模式下在项目中工作的相同代码,构建为发行版,那么这是一个IIS问题还是我需要对XML做些什么?为什么相同的XML在我的本地PC(64位Win7)上工作但不是Win 2008 server上的IIS 7吗?

您好,我只是想让您知道,我通过根文件夹中的web.config文件修复了它,并删除了它抱怨的行

这将错误移到下一行

所以我只是继续删除IIS抱怨的行,直到XML部分变成一个空组

 <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">          
      <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">           
       </sectionGroup>
    </sectionGroup>

因此,我不知道复制是从哪里来的,也不知道为什么IIS会抱怨,因为我检查了Web服务器上的事件日志,没有发现与我访问页面有关的任何错误


不管怎样,删除它抱怨的行解决了问题。

您查看过更高级别的目录,或ASP.NET或机器配置文件吗?@AndrewBarber说了什么,但一定要了解ASP.NET配置是如何工作的-它是分层的。是的,我不是这方面的专家。在IIS中编写代码但配置-他们已经从我手中夺走了这一点。我只知道它可以在我的机器上运行,例如,在本地主机上使用相同的文件作为调试运行,但不能在他们为我设置的服务器上运行。这些文件存放在哪里?路径是wwwroot/myservice\u co\u uk/http.demo/web.config