• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1258
  • Last Modified:

How to override some Machine.config info

I have an asp.net application that works great when I run it locally but when I upload it to my hosting solution, I get this error.
Unrecognized configuration section system.serviceModel.
In researching it, I found out that this is due to missing info in the machine.config file (according to this http://weblogs.asp.net/bhouse/archive/2005/11/10/430270.aspx) however, I don't have access to the machine.config file on the host server so I wanted to override it. I tried adding the missing stuff to my web.config file but I'm getting the same error. Not sure if I'm doing it wrong or if it's not possible to override it. Can someone please take a look?
<?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"/>
<!--added to try and avoid machine.config error-->
          <sectionGroup name="system.serviceModel" type="System.ServiceModel.Configuration.ServiceModelSectionGroup, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <section name="behaviors" type="System.ServiceModel.Configuration.BehaviorsSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <section name="client" type="System.ServiceModel.Configuration.ClientSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <section name="comContracts" type="System.ServiceModel.Configuration.ComContractsSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <section name="commonBehaviors" type="System.ServiceModel.Configuration.CommonBehaviorsSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowDefinition="MachineOnly" allowExeDefinition="MachineOnly" />
            <section name="diagnostics" type="System.ServiceModel.Configuration.DiagnosticSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <section name="extensions" type="System.ServiceModel.Configuration.ServiceModelExtensionsSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <section name="serviceHostingEnvironment" type="System.ServiceModel.Configuration.ServiceHostingEnvironmentSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <section name="services" type="System.ServiceModel.Configuration.ServicesSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <sectionGroup name="bindings" type="System.ServiceModel.Configuration.BindingsSectionGroup, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
              <section name="basicHttpBinding" type="System.ServiceModel.Configuration.BasicHttpBindingSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <section name="customBinding" type="System.ServiceModel.Configuration.CustomBindingSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <section name="msmqIntegrationBinding" type="System.ServiceModel.Configuration.MsmqIntegrationBindingSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <section name="netMsmqBinding" type="System.ServiceModel.Configuration.NetMsmqBindingSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <section name="netNamedPipeBinding" type="System.ServiceModel.Configuration.NetNamedPipeBindingSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <section name="netPeerTcpBinding" type="System.ServiceModel.Configuration.NetPeerTcpBindingSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <section name="netTcpBinding" type="System.ServiceModel.Configuration.NetTcpBindingSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <section name="wsDualHttpBinding" type="System.ServiceModel.Configuration.WSDualHttpBindingSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <section name="wsFederationBinding" type="System.ServiceModel.Configuration.WSFederationBindingSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <section name="wsHttpBinding" type="System.ServiceModel.Configuration.WSHttpBindingSection, System.ServiceModel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            </sectionGroup>
          </sectionGroup>
<!--end of new added section-->

        </sectionGroup>
			</sectionGroup>
		</sectionGroup>
	</configSections>
  <appSettings>
    <add key="SandboxPath" value="C:\Users\Gwenna"/>
    <add key="UploadFolder" value="~/documents"/>
    <add key="StorageFolder" value="~/documents"/>
  </appSettings>
	<connectionStrings/>
	<system.web>
    <!--<urlMappings enabled="true">
      <add url="~/FileUpload.ashx" mappedUrl="~/FileUpload.ashx"/>
    </urlMappings>-->

    <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
		<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. 
        -->
    <authorization>
      <allow users="?" />
    </authorization>
		<!--<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"/>
        <add tagPrefix="asp" assembly="System.Web.Silverlight" namespace="System.Web.UI.SilverlightControls"/>
			</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"/>
      <!--added to try to avoid machine.config error-->
      <add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
      <!--end of new addition-->
     
		</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 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>
  
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IFileReceiver" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            </binding>
      </basicHttpBinding>
     </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
      <service behaviorConfiguration="AMS_SL3_new.Web.Services.FileReceiverBehavior"
          name="AMS_SL3_new.Web.Services.FileReceiver">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileReceiver" 
                  contract="AMS_SL3_new.Web.Services.IFileReceiver">
         </endpoint>
        <endpoint address="mex"  binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>    
    <behaviors>
      <serviceBehaviors>
        <behavior name="AMS_SL3_new.Web.Services.FileReceiverBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>   
  
    <client />
  </system.serviceModel>

 
</configuration>

Open in new window

0
boukaka
Asked:
boukaka
  • 6
  • 5
1 Solution
 
Jon500Commented:
I'm pretty sure you need to use:

system.ServiceModel

in your Xml document. Size (in this case, case) matters. :)

Cheers,
Jon500
0
 
boukakaAuthor Commented:
lol.. cute, I tried that and it didn't work. According to MSDN, it should actually be camel casing

http://msdn.microsoft.com/en-us/library/ms731354.aspx
0
 
Jon500Commented:
OK, now I am officially confused. In *this* Microsoft link, they use an uppercase "S" (see the example code they show): http://msdn.microsoft.com/en-us/library/ms733932.aspx

Did you try it or did you only get discouraged when you saw the documentation? I wonder which case is correct? I will try to test it here to see what works...

I really thought I had the answer for you... Sorry, but I will try again if I have any further information.

Jon500
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
boukakaAuthor Commented:
I actually tried it - the documentation is not always right :)
0
 
Jon500Commented:
Is it possible that your host has your application set to run under ASP.Net 2.0 and not 3.x? According to my research, Service Model (serviceModel) was not available in the .Net 2.0 framework. If an exception is being thrown to your ASP.Net page (from your host company's server), inspect the output for the .Net framework that is being used to host your page.

I hope this gets a little closer to the answer...
0
 
boukakaAuthor Commented:
AH, thank you for that thought, I'll ask them. I'm pretty sure if they don't currently support 3.5, they will add that functionality (or they had better :), Most new applications will be running under it and they are going to run into more and more issues if they don't. I may be a bit getting back to you to accept (if this is the solution) because I'll have to wait for them to respond. I'll let you know what I find out.
0
 
Jon500Commented:
Good luck. I think it's a good bet, especially because (and I missed this point earlier) it works on your local system. Just remember to view the error page--or don't trust the host company and write an ASP.Net page that echoes the framework version using something like this:

No matter what they tell me, my host is running <%= System.Environment.Version %>.

:)

Cheers,
Jon500
0
 
boukakaAuthor Commented:
Hi Jon,

Well you nailed it - they currently only support .net 2.0. I've asked if they would be willing to upgrade but have not heard back and my deadlines are fairly tight. I'm more than happy to give you the points but I still have the dilemma of this thing not working. Do you know if there's a way to accomplish the same thing I'm doing below but with something that IS compatible with 2.0? I may not have time to wait for them to respond and I'm not even sure how I would use a domain registered with them on another provider's site (I'm assuming it can be done but I'd rather keep everything in one place.. only so many passwords will stick in my head)

 <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IFileReceiver" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />          
        </binding>
      </basicHttpBinding>      
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
      <service behaviorConfiguration="AMS_SL3_new.Web.Services.FileReceiverBehavior"
          name="AMS_SL3_new.Web.Services.FileReceiver">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileReceiver"
                  contract="AMS_SL3_new.Web.Services.IFileReceiver">        
        </endpoint>
        <endpoint address="mex"  binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>    
    <behaviors>
      <serviceBehaviors>
        <behavior name="AMS_SL3_new.Web.Services.FileReceiverBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>  
 
    <client />
  </system.serviceModel>

Thank you,
Gwenna
0
 
Jon500Commented:
Hi,

You're using features from WCF--introduced in .Net 3.0. To use 2.0, you will need to make changes to your web services. That's a huge subject (entire books are written about web services) and there is a lot of free stuff on the web regarding them.

Scott Mitchell is one of my favorite authors. He has a guide here that should be most useful:
http://www.4guysfromrolla.com/articles/062602-1.aspx

Good luck,
Jon500
0
 
boukakaAuthor Commented:
Eek, scary! *sigh*, ok, thank you very much. I'll check out their guide.
0
 
Jon500Commented:
Good luck, and thank you for the points.

Regards,
Jon500
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now