Webconfig error ASPX and ASHX

378 views Asked by At

I have been put in charge of maintaining an old legacy website(hasn't been touched in maybe 4-5 years) using ASPX and ASHX. The website was working decently on server 2003, but the web host forced us to move to 2008. Upon moving to 2008 we received this error

Config Error    Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'WebCoreModule.ashx_*'

 178:       <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" />
  179:       <add name="WebCoreModule.ashx_*" path="WebCoreModule.ashx" verb="*" type="Radactive.WebControls.ILoad.Core.WebCoreModule, Radactive.WebControls.ILoad.Core" preCondition="integratedMode,runtimeVersionv2.0" />
  180:     </handlers>

I have done quite a bit of research and made several attempts changing and playing with the _* to no avail, I even tried a recommendation on another post here suggesting that I add <remove name "WebCoreModule.ashx_*" /> to the start of the handler tag, but was met with limited success. The Website loads, but the smtp.Send(msgMail) email does not send, and no errors are displayed. Normally, I would try to figure this out on my own, but since it is considered a down scenario (just deleting the line allows the website to run, but some functions for example emailing does not work) I would appreciate any help I could get. Here is the remainder of the config

<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="WebCoreModule.ashx_*" path="WebCoreModule.ashx" verb="*" type="Radactive.WebControls.ILoad.Core.WebCoreModule, Radactive.WebControls.ILoad.Core" preCondition="integratedMode,runtimeVersionv2.0" />
    </handlers>

If you need any additional information please feel free to ask, I am at wits end and am getting heavy grief from management. Thanks!

2

There are 2 answers

0
Robert Dickey On BEST ANSWER

After completely stripping the existing email code and adding new code I discovered that the issue was caused by the old server having the port and SSLenable configured by default, where as the new server did not have such things preconfigured. I resolved the issue by using port = "587" Sslenable = true in the web.config email section.

1
Emanuele Greco On

Try this

<remove name="WebCoreModule.ashx_*" />
<add name="WebCoreModule.ashx_*" ...