Cannot parse *.Config file - winforms

In a .NET 4.5 Winforms app and using the exact code from the PayPal API doc I'm getting:
"Cannot parse *.Config file. Ensure you have configured the 'paypal' section correctly."
I'm just posting the line that causes this:
OAuthTokenCredential tokenCredential = new OAuthTokenCredential("xxxxxxxxxxxxxx", "xxxxxxxxxx");
Any ideas how to proceed?
Thanks

Since Steve chose to be obtuse, for the sake if anyone else having this issue, here is the link to a similar question which solved my problem. Might be my lack of experience working with app.config files but I had to be sure to insert the code as the first entries in the file or my HttpClient class failed on startup.
Link that put me on the right path:
Paypal c# REST API asks for an undocumented configuration section
My App.config file (basic App.config file from a new VS2013 WinForms project after adding the NuGet PayPal REST SDK Package and the parts from the solution from the link above)
As mentioned on the link as well, aaa, bbb, ccc, ddd are from your sandbox account profile.
<configSections>
<section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPalCoreSDK"/>
</configSections>
<paypal>
<accounts>
<account apiUsername="aaa"
apiPassword="bbb"
applicationId="ccc"
apiSignature="ddd"/>
</accounts>
<settings>
<add name="mode" value="sandbox"/>
</settings>
</paypal>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

Related

How to deal with decimal separator when uploading geometries to MSSQL server using shape2sql.exe?

I'm using Shape2Sql.exe to upload .shp shapefile to MSSQL server 13.0.4502.0 on a Win10 64bit laptop. I've added Shape2Sql.exe.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-14.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
so that I could run the SqlServerSpatial130.dll correctly. Also erased ID Column name field (I found this suggestion on this question).
The geometry uploads correctly but latitudes and longitudes are in this format '524601.70435768971' '6525809.6313226018' and I think is a problem of the decimal separator character on shapefile but I couldnt find where to configure it.
This is the .shp file I'm trying to upload.
Shape2Sql.exe is part of the SqlSpatialTools software packege of www.sharpgis.net.

How to load a App.Config file into a VCL application?

I am trying the RemObject Hydra to embed a WPF module inside a VCL app.
In this WPF module, I have Grid Controls, and EntityFramework DataContext. It's connectionString, providers and everything stored in a app.config.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="ModelConnection" connectionString="character set=UTF8;data source=localhost;initial catalog=PATHTODATABASE.FDB;user id=SYSDBA;password=MASTERKEY" providerName="FirebirdSql.Data.FirebirdClient" />
</connectionStrings>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="FirebirdSql.Data.EntityFramework6.FbConnectionFactory, EntityFramework.Firebird" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="FirebirdSql.Data.FirebirdClient" type="FirebirdSql.Data.EntityFramework6.FbProviderServices, EntityFramework.Firebird" />
</providers>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant="FirebirdSql.Data.FirebirdClient" />
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient" />
</DbProviderFactories>
</system.data></configuration>
The next step was to make the VCL host with delphi then load the WPF module's .dll using the HYModuleManager component. This is pretty straigtforward :
procedure TMainForm.FormCreate(Sender: TObject);
begin
HYModuleManager1.LoadModule('%path%\to\wpf\module\GridsModule.dll');
HYModuleManager1.CreateVisualPlugin('ClientGridView', fInstance, Panel1);
end;
I run the application in Delphi. But this error is thrown :
(Translation : An exception was thrown by the target of an invocation)
So with a little more research, I run this application (HydraHost.exe) using VisualStudio, and realize that this si the exception thrown by the module :
System.InvalidOperationException : 'No connection string named 'ModelConnection' could be found in the application config file.'
I then decide to write a WPF host. I set the WPF Host App.config to include the connection string and provider infos. To no surprise, everything works fine.
So, with the VCL host, the connectionString is not found. With the WPF host, it is. My conclusion is that the app.config is not loaded by the VCL host but it is loaded by the WPF host.
So what I did next is to manually copy the WPFHost.dll.config to VCLHost.exe.config as suggested by one of the answers, but same error, connectionString is not found.
So my question is : How can I "link" a .exe.config to a VCL app built with Delphi?
You should rename your app.config to YourExeName.exe.config as it's probably now YourDllName.dll.config

Building WPF application using Microsoft.Build assemblies

I am trying to perform a build on a WPF (.Net Framework 4.0) project using the Microsoft.Build assemblies, i.e. not building from VS and not building using stock standard MSBuild from command line. All my projects build successfully, but the WPF project fails with the following message:
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Microsoft.WinFx.targets(268,9): error MSB4127: The "MarkupCompilePass1" task could not be instantiated from the assembly "PresentationBuildTasks, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Please verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one installed on your computer and that your host application is not missing a binding redirect for Microsoft.Build.Framework. Unable to cast object of type 'Microsoft.Build.Tasks.Windows.MarkupCompilePass1' to type 'Microsoft.Build.Framework.ITask'. [C:\Service\Test.csproj]
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Microsoft.WinFx.targets(268,9): error MSB4060: The "MarkupCompilePass1" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name.
I have found references (on Stack Overflow) mentioning the updated MSBuild assemblies (12.0 vs 4.0) etc etc. This has all been updated, i.e. references from the build utility, but no luck.
Any ideas/suggestions?
We are using a similar system and the problem seems to stem from the compilation of the Page tag: <generator>MSBuild:Compile</generator>. This seems to be invoking MSBuild in a way that pulls the 4.0 framework libraries.
For our build executable, we simply modified the configuration to include the configurations used by the 12.0 MSBuild configuration. i.e., take the elements in C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe.config and place them in your application configuration. This resolved the issues for us.
I found a solution. Add a binding redirect to the version you want to use in your App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Determine correct connectionString for web publishing for ASP.NET-MVC application

During development of ASP.NET-MVC application on local machine I used this connectionStringwith no problems whatsoever:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\AppDb.mdf;Initial Catalog=AppDb;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
In hosting service database control panel I can get connection string to my MSSQL(I selected SQL Server 2012 database, but I can choose 2014 if it helps). They say connection string is:
"Data Source=SQL5013.myASP.NET;Initial Catalog=DB_9B42A0_baza;User Id=DB_9B42A0_baza_admin;Password=YOUR_DB_PASSWORD;"
Info about my MSSQL database:
Server name : SQL5013
Server version : Microsoft SQL Server 2012 - 11.0.5058.0 (X64)
May 14 2014 18:34:29
Standard Edition (64-bit) on Windows NT 6.3 (Build 9600: )
Database name:DB_9B42A0_baza
Server URL:SQL5013.myASP.NET
Login name:DB_9B42A0_baza_admin
My application is ASP.NET-MVC5.1 with Entity Framework 6.
Here it is what I have tried:
Attempt 1
Added this connection definition between <connectionStrings> </connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=SQL5013.myASP.NET;Initial Catalog=DB_9B42A0_baza;User Id=DB_9B42A0_baza_admin;Password=12345678;" providerName="System.Data.SqlClient" />
Result when accessing my website:
Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
Attempt 2
<add name="DefaultConnection" connectionString="Provider=sqloledb;Data Source=SQL5013,1433;Initial Catalog=DB_9B42A0_baza;User Id=DB_9B42A0_baza_admin;Password=12345678;" providerName="System.Data.SqlClient" />
Result when accessing my website:
Exception Details: System.ArgumentException: Keyword not supported: 'provider'.
Attempt 3
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\AppDb.mdf;Initial Catalog=AppDb;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
Plus in WebApplication2(this is the name of my ASP.NET-MVC application) properties:
Result when accessing my website:
Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
Attempt 4 (based on first example from http://www.connectionstrings.com/sqlconnection/ )
<add name="DefaultConnection" connectionString="Server=SQL5013.myASP.NET;Database=DB_9B42A0_baza;User Id=DB_9B42A0_baza_admin;Password=12345678;" providerName="System.Data.SqlClient" />
Result when accessing my website:
Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
Summary:
I tried many more things to make it work during last 3 days which I don't remember. I read lot of MSDN articles and no luck. If I can supply any more information about the database or application please tell I will update post shortly.
Question:
What should I write in <connectionStrings> </connectionStrings> seciton to make the database connection work after I publish it?
Additional info:
My full Web.config file is:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\AppDb.mdf;Initial Catalog=AppDb;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<customErrors mode="Off"/>
</system.web>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Update -> code resposible for database
Application_Start in Global.asax
namespace WebApplication2 {
public class MvcApplication : System.Web.HttpApplication {
protected void Application_Start() {
System.Diagnostics.Debug.WriteLine("Application_Start");
Database.SetInitializer(new MigrateDatabaseToLatestVersion<ApplicationDbContext, Configuration>());
new ApplicationDbContext().Database.Initialize(true);
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
and the Configuration/Migrations.cs file:
namespace WebApplication2.Migrations {
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations;
using System.Data.Entity.Validation;
using System.Linq;
using WebApplication2.Models;
internal sealed class Configuration : DbMigrationsConfiguration<WebApplication2.Models.ApplicationDbContext> {
public Configuration() {
AutomaticMigrationsEnabled = true;
AutomaticMigrationDataLossAllowed = true;
ContextKey = "WebApplication2.Models.ApplicationDbContext";
}
protected override void Seed(WebApplication2.Models.ApplicationDbContext context) {
System.Diagnostics.Debug.WriteLine("SEED STARTED");
}
}
}
and Models/IdentityModels.cs where is my DbContext defined:
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System;
using System.Collections.Generic;
namespace WebApplication2.Models {
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser {
USER PROPERTIES HERE
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager) {
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> {
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false) {
System.Diagnostics.Debug.WriteLine("CONSTRUCTOR");
Configuration.LazyLoadingEnabled = true;
Configuration.ProxyCreationEnabled = true;
}
DBSETS HERE
protected override void OnModelCreating(DbModelBuilder modelBuilder) {
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Person>().HasMany(p => p.Answers).WithMany(a => a.Persons);
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
public static ApplicationDbContext Create() {
return new ApplicationDbContext();
}
}
}
Foot note
I am not eligible to start bounty before 2 days from asking a question but if this helps I offer 500 reputation points for working connection string (I will award it when the bounty will be possible). It is too hard to me and I tried countless things for 3 days.
Connection string in Attempt 2 is incorrect as the error says. Connection string in Attempt 3 is pointing to local. However Attempt 1 & 4 looks perfectly valid.
Have you tried publishing the web site using right click on the project-->Publish instead of going to project properties-->Package/Publish SQL?
Please note when using Project properties-->Package/Publish SQL, it doesn't update the web.config on the destination and will require a web config transform. If you have not used a transform, the connection string will be pointing to the one you had in your local.
Using right click on the project-->Publish you can provide the destination connection string, test it and then can even make this update the web.config during deployment. Ensure that the Use this connection string at runtime (update destination web.config) is checked.
UPDATE:
With regards to your question - "why my previous attempts failed?"
As above, attempt 1 & 4 looks like you have got a valid connection string but still getting the error
System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
It appears this error can occur for variety of reasons - as similar questions asked here and here have different solutions. But most possibly it is down to an incorrect connection string.
The only way to make sure is, to check what is there in your web.config after deploy/publish to hosting service. If you are sure that the web.config after deployment had the same connection string as attempt 1 & 4 then it is strange indeed.
Also, in attempt 3, the Connection string for destination database looks different to your other connection strings and is this tested? This and the fact that web publish method as I mentioned above worked instead of using Package/Publish SQL makes me think that the database might have not been deployed in your previous attempts. Why not repeat the same steps but deploy it to a location where you access the web.config and also check whether the db is deployed successfully?
Now, on - "how would section or Web.config should exactly look like in my case to make database work after publishing web application on the server without adding anything to Publish Web Settings tab?"
By not setting anything in Database section of the Settings tab in Publish Web tool - your database will not be deployed. I am not sure you want to do that considering you are using migrations.
But if you are planning to deploy your database separately for whatever reasons - then you need to apply transformations to your web.config to make it automatically change the connection string while publishing.
More information on how to do web.config transformation can be found here.
The following pages are great place to understand web and database publish
MSDN - covers complete deployment overview including code first migrations
ASP.NET site - focusing on hosting services deployment and deployments to different environments
Hope this helps.
This is not exactly a fix but will allow you to test the connection string abstracted outside of all that code to validate that at least your connection string itself is or is not working. This should also give you a way to test it quicker.. post back your findings and I will see if I can contribute more.
On the server using LinqPad, or technically you can create a test page in your app with a textbox for you to paste your connection string to test and then run it against the following code.
using(var conn = new SqlConnection("Connection String Here"))
conn.Open();
This is the minimal code needed, if you can make this work with your current connection string you know something else is going on, otherwise it gives you a fast way to poke at it until it works.

MissingMethodException when running application on different computer

I have a problem where I compiled my application on Visual Studio 2010 while targetting the .NET Framework 3.5, deployed it to a client server, only to find it gives me the following error:
************** Exception Text **************
System.MissingMethodException: Method not found: 'Void
System.Xml.Xsl.XslCompiledTransform.Transform(
System.Xml.XPath.IXPathNavigable,
System.Xml.Xsl.XsltArgumentList,
System.Xml.XmlWriter,
System.Xml.XmlResolver)'.
************** Loaded Assemblies **************
[...]
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
The method it says it's looking for is this: XslTransform.Transform Method (IXPathNavigable, XsltArgumentList, XmlWriter, XmlResolver) (Supported in: 4, 3.5, 3.0, 2.0, 1.1)
I've tried setting up a redirect to the .NET Framework 4.0 version of the same DLL using the assemblyBinding element like so:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Xml"
publicKeyToken="b77a5c561934e089"
culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0"
newVersion="4.0.0.0"/>
<codeBase version="4.0.0.0"
href="file:///C:/WINDOWS/Microsoft.NET/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>
But now the application won't run, and puts this in the event log:
EventType clr20r3, P1
myapplication.exe, P2 3.85.12.27583,
P3 4be9757f, P4 system.configuration,
P5 2.0.0.0, P6 4889de74, P7 1a6, P8
136, P9
ioibmurhynrxkw0zxkyrvfn0boyyufow, P10
NIL.
So, in summary, (1) does anyone know why the application can't find the method listed, and (2) why doesn't it let me redirect to the .NET 4.0 version of System.Xml?
Any help is appreciated, I'm totally stuck!
app.config as requested:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="myapplication.Properties.UserSettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<system.net>
<mailSettings>
<smtp from="e-monitoring#myapplication.co.uk">
<network defaultCredentials="true" host="192.168.0.132" port="25" password="" userName="" />
</smtp>
</mailSettings>
</system.net>
<appSettings file="">
<add key="ReportDataCollectionTimeout" value="360" />
<add key="AllowedDatabaseBuild" value="3" />
<add key="AllowedDatabaseRevision" value="085" />
<add key="HelpNamespace" value="myapplicationHelpfile.chm" />
<add key="ProFormaHomePageUri" value="https://myapplication.co.uk/" />
<add key="ProFormaLoginPageUri" value="https://myapplication.co.uk/login.aspx" />
</appSettings>
<connectionStrings configSource="connectionStrings.config" />
<userSettings>
<myapplication.Properties.UserSettings>
<setting name="RequiresUpgrade" serializeAs="String">
<value>True</value>
</setting>
</myapplication.Properties.UserSettings>
</userSettings>
</configuration>
If you are targeting .NET 3.5 why are you doing a binding redirect to System.Xml v4.0.0.0? Make sure that your project references v2.0.0.0 of that assembly and that you have the following in your app.config:
<startup><supportedRuntime version="v2.0.50727"/></startup>
Also make sure that you are targeting .NET Framework 3.5 and not .NET Framework 3.5 Client Profile. Finally make sure the client has .NET 3.5 installed.
I've solved the problem by using this Transform method instead of the previous one (where I was previously passing null into the XmlResolver argument at the end).
Strange how this worked on my development and test machine, and not the server.
Try looking into the file version for System.XML.dll in the assembly folder. chances are that the last bit of the file on your system are different then the ones on server. in your case "2.0.50727.3082" does not seem to have the specified method signature. The version on the development machine was "2.0.50727.8009" which did have the required method signature.
EDIT: Decided to use the XMLReader version of the method. Even though we could register the newer version in the GAC(which did'nt give runtime error) from our local machine and that removed the error. but since the .NET could upgrade to a newer version and overwrite GAC we would need to be careful that the newer version would not have same problem.

Resources