Why is my self hosted Web API service throwing an exception on Windows 2012? - .net-4.5

I have an app. I'm working on which self-hosts WebApi. It can run as either a command-line app, or as a Windows service. It's compiled using the .NET 4.5 runtimes.
When I run it on my Windows 7 dev. machine, it works fine.
When I deploy and run as a command-line app on my Windows 2012 server machine, it fails with the exception:
Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments,
Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Objec
t[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture)
at Owin.Loader.DefaultLoader.<>c__DisplayClass12.<MakeDelegate>b__b(IAppBuild
er builder)
at Owin.Loader.DefaultLoader.<>c__DisplayClass1.<LoadImplementation>b__0(IApp
Builder builder)
at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveApp(StartContext contex
t)
at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
at Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start(StartOptions opt
ions)
at Microsoft.Owin.Hosting.Starter.HostingStarter.Start(StartOptions options)
at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider service
s, StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start(StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start[TStartup](StartOptions options)
My code does this:
url = "http://localhost:5000";
_app = WebApp.Start<WebAppConfiguration>(url);
And the WebAppConfiguration class looks like this:
public class WebAppConfiguration : HttpConfiguration
{
public void Configuration(IAppBuilders app)
{
ConfigureRoutes();
ConfigureJsonSerialization();
// This line throws the exception:
app.UseWebApi(this);
}
}
I did some searching and it sounded like I needed to reserve the port using NETSH, so this is what I did from an Admin command prompt:
netsh http add urlacl url=http://localhost:5000/ user=Everyone listen=yes delegate=yes
Unfortunately, I'm still getting the exception. Is there some other step I need to do to get this to work under Windows Server 2012?
EDIT:
The inner exception (which I didn't think to log) contained a much more helpful error. It turns out I was missing an assembly binding entry for Microsoft.Owin in my .config file for Owin. This was in my dev. version but didn't make it into the version on my server.

Related

Database Migration is getting failed due to NLOG.config in Visual Studio 2022 Mac

I started programming with Visual Studio 2022 in Mac M1. I am developing an application with .net core 6 and initially I used to develop in Windows. I copied my project and started to work in VS 2022 Mac. While doing the DB Migration (Using dotnet CLI) I am getting error and it's getting failed due to NLog.config. I am using NLog for the logging functionality.
DataAccess layer and WepAPI are separate project in a solution.DBContextClass and migration scripts are present in DataAccess Layer and the connection string is present in WebAPI.
Error while doing the db migration:
Time Elapsed 00:00:01.65 Build succeeded. dotnet exec --depsfile
/Users/MASKED/Projects/MyCoreApplication/MyCoreApplicationWebAPI/bin/Debug/net6.0/MyCoreApplicationWebAPI.deps.json
--additionalprobingpath /Users/MASKED/.nuget/packages --runtimeconfig /Users/MASKED/Projects/MyCoreApplication/MyCoreApplicationWebAPI/bin/Debug/net6.0/MyCoreApplicationWebAPI.runtimeconfig.json
/Users/MASKED/.dotnet/tools/.store/dotnet-ef/6.0.7/dotnet-ef/6.0.7/tools/net6.0/any/tools/netcoreapp2.0/any/ef.dll
database update -c ApplicationDbContext --assembly
/Users/MASKED/Projects/MyCoreApplication/MyCoreApplicationWebAPI/bin/Debug/net6.0/MyCoreApplication.DataAccess.dll
--project /Users/MASKED/Projects/MyCoreApplication/MyCoreApplication.DataAccess/MyCoreApplication.DataAccess.csproj
--startup-assembly /Users/MASKED/Projects/MyCoreApplication/MyCoreApplicationWebAPI/bin/Debug/net6.0/MyCoreApplicationWebAPI.dll
--startup-project /Users/MASKED/Projects/MyCoreApplication/MyCoreApplicationWebAPI/MyCoreApplicationWebAPI.csproj
--project-dir /Users/MASKED/Projects/MyCoreApplication/MyCoreApplication.DataAccess/
--root-namespace MyCoreApplication.DataAccess --language C# --framework net6.0 --nullable --working-dir /Users/MASKED/Projects/MyCoreApplication/MyCoreApplication.DataAccess
--verbose Using assembly 'MyCoreApplication.DataAccess'. Using startup assembly 'MyCoreApplicationWebAPI'. Using application base
'/Users/MASKED/Projects/MyCoreApplication/MyCoreApplicationWebAPI/bin/Debug/net6.0'.
Using working directory
'/Users/MASKED/Projects/MyCoreApplication/MyCoreApplicationWebAPI'.
Using root namespace 'MyCoreApplication.DataAccess'. Using project
directory
'/Users/MASKED/Projects/MyCoreApplication/MyCoreApplication.DataAccess/'.
Remaining arguments: . Finding DbContext classes... Finding
IDesignTimeDbContextFactory implementations... Finding application
service provider in assembly 'MyCoreApplicationWebAPI'... Finding
Microsoft.Extensions.Hosting service provider... Using environment
'Development'. NLog.NLogConfigurationException: Exception when loading
configuration
/Users/MASKED/Projects/MyCoreApplication/MyCoreApplicationWebAPI/nlog.config
---> System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at
System.Xml.XmlTextReaderImpl.ParseDocumentContent() at
System.Xml.XmlTextReaderImpl.Read() at
System.Xml.XmlReader.MoveToContent() at
NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader,
String fileName, Boolean ignoreErrors) --- End of inner exception
stack trace --- at
NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader,
String fileName, Boolean ignoreErrors) at
NLog.Config.XmlLoggingConfiguration..ctor(XmlReader reader, String
fileName, LogFactory logFactory) at
NLog.Config.LoggingConfigurationFileLoader.LoadXmlLoggingConfiguration(XmlReader
xmlReader, String configFile, LogFactory logFactory) at
NLog.Config.LoggingConfigurationFileLoader.LoadXmlLoggingConfigurationFile(LogFactory
logFactory, String configFile) at
NLog.Config.LoggingConfigurationFileLoader.TryLoadLoggingConfiguration(LogFactory
logFactory, String configFile, LoggingConfiguration& config) at
NLog.Config.LoggingConfigurationFileLoader.Load(LogFactory logFactory,
String filename) at
NLog.Config.LoggingConfigurationWatchableFileLoader.Load(LogFactory
logFactory, String filename) at
NLog.LogFactory.LoadConfiguration(String configFile, Boolean optional)
at NLog.LogFactory.LoadConfiguration(String configFile) at
NLog.LogManager.LoadConfiguration(String configFile) at
Program.$(String[] args) in
/Users/MASKED/Projects/MyCoreApplication/MyCoreApplicationWebAPI/Program.cs:line
25
--- End of stack trace from previous location --- at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.CreateHost()
at
Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass10_0.b__0(String[]
args) at
Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass13_0.b__3(String[]
args) at
Microsoft.EntityFrameworkCore.Design.Internal.AppServiceProviderFactory.CreateFromHosting(String[]
args)
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error:
Exception when loading configuration
/Users/MASKED/Projects/MyCoreApplication/MyCoreApplicationWebAPI/nlog.config
No application service provider was found. Finding DbContext classes
in the project... Found DbContext 'ApplicationDbContext'.
Microsoft.EntityFrameworkCore.Design.OperationException: Unable to
create an object of type 'ApplicationDbContext'. For the different
patterns supported at design time, see
https://go.microsoft.com/fwlink/?linkid=851728 --->
System.InvalidOperationException: Unable to resolve service for type
'Microsoft.EntityFrameworkCore.DbContextOptions1[MyCoreApplication.DataAccess.Data.ApplicationDbContext]' while attempting to activate 'MyCoreApplication.DataAccess.Data.ApplicationDbContext'. at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetServiceOrCreateInstance(IServiceProvider provider, Type type) at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.<>c__DisplayClass21_4.<FindContextTypes>b__13() --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.<>c__DisplayClass21_4.<FindContextTypes>b__13() at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(Func1
factory) at
Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String
contextType) at
Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String
targetMigration, String connectionString, String contextType) at
Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String
targetMigration, String connectionString, String contextType) at
Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at
Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action
action)
Unable to create an object of type 'ApplicationDbContext'. For the different patterns supported at design time, see
https://go.microsoft.com/fwlink/?linkid=851728

"Installing MDriven Server on Windows" - cannot access local Turnkey

I have tried to install MDriven Server and Turnkey according to the page "Installing MDriven Server on Windows" (https://wiki.mdriven.net/index.php/Installing_MDriven_Server_on_Windows) and the Video (https://www.youtube.com/watch?time_continue=722&v=q0ppL5sMPGg).
Installed versions are MDrivenServer_20190411.zip and MDrivenTurnkey_20190415.zip
The PC is a Windows 2019 Server (also tried on Windows 10 Workstation, results are identical!).
I can open the MDriven Server pages (https://MyServer/MyTurnkeyApp/__MDrivenServer) everything looks fine, i.e.:
I created a new "a" user with a known PWD according to the Video
DB connectivity/check/evolve is fine
https/Self-signed SSL certificate works as expected
MDrivenServer works as expected and as described in the article & video!
However I cannot go to the Turnkey pages (https://MyServer/MyTurnkeyApp).
I always get an error message:
Server Error in '/MyTurnkeyApp' Application.
Not able to start, check the CurrentVersion - is it set? Check that the app is Started and not Paused. Check that the Version is in DatabaseUpdated state.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Not able to start, check the CurrentVersion - is it set? Check that the app is Started and not Paused. Check that the Version is in DatabaseUpdated state.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Exception: Not able to start, check the CurrentVersion - is it set? Check that the app is Started and not Paused. Check that the Version is in DatabaseUpdated state.]
AppCompleteGeneric.ACApplication.GetStartedAndRunningFromDatabaseIdentity(EcoSpace adminEcoSpace, DatabaseIdentity databaseIdentity) in c:\capableobjectsbuild2017\source\AppCompleteGeneric\AppCompleteGeneric.Model\AppCompleteGeneric\ACApplication.cs:51
TurnKeyEcoSpaceWithModelFromServer.TurnKeyEcoSpaceCreator.GetBlank(String databaseID) in c:\capableobjectsbuild2017\source\StreamingApp\StreamingAppGenericAPIAndControllers\TurnKeyEcoSpaceCreator.cs:115
TurnKeyEcoSpaceWithModelFromServer.TurnKeyEcoSpaceCreator.BorrowEcoSpace(EcoSpaceRequestInfo requestInfo) in c:\capableobjectsbuild2017\source\StreamingApp\StreamingAppGenericAPIAndControllers\TurnKeyEcoSpaceCreator.cs:289
Eco.MVC.EcoController1.EnsureEcoSpace(String shelfKey) in c:\capableobjectsbuild2017\source\Eco\Eco.MVC\EcoController.cs:408
Eco.MVC.EcoController1.OnActionExecuting(ActionExecutingContext filterContext) in c:\capableobjectsbuild2017\source\Eco\Eco.MVC\EcoController.cs:549
Eco.MVC.ModelDrivenControllerBase1.OnActionExecuting(ActionExecutingContext filterContext) in c:\capableobjectsbuild2017\source\Eco\Eco.MVC\ModelDrivenControllerBase.cs:97
System.Web.Mvc.Async.AsyncInvocationWithFilters.InvokeActionMethodFilterAsynchronouslyRecursive(Int32 filterIndex) +261
System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__31(AsyncCallback asyncCallback, Object asyncState) +100
System.Web.Mvc.Async.WrappedAsyncResultBase1.Begin(AsyncCallback callback, Object state, Int32 timeout) +166
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeActionMethodWithFilters(ControllerContext controllerContext, IList1 filters, ActionDescriptor actionDescriptor, IDictionary2 parameters, AsyncCallback callback, Object state) +333
System.Web.Mvc.Async.<>c__DisplayClass21.b__19(AsyncCallback asyncCallback, Object asyncState) +1151
System.Web.Mvc.Async.WrappedAsyncResultBase1.Begin(AsyncCallback callback, Object state, Int32 timeout) +166
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +463
System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +42
System.Web.Mvc.Async.WrappedAsyncVoid1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +73
System.Web.Mvc.Async.WrappedAsyncResultBase1.Begin(AsyncCallback callback, Object state, Int32 timeout) +166
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +906
System.Web.Mvc.Async.WrappedAsyncResultBase1.Begin(AsyncCallback callback, Object state, Int32 timeout) +166
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +711
System.Web.Mvc.MvcHandler.b__4(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +93
System.Web.Mvc.Async.WrappedAsyncVoid1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +73
System.Web.Mvc.Async.WrappedAsyncResultBase1.Begin(AsyncCallback callback, Object state, Int32 timeout) +166
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +522
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +1020
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128
Any idea what's wrong?
Check this answer: MDriven Server installation
I think it is the same issue.
You have no model uploaded to mdriven server
or the model is not selected as current
or the app slot A0 is not started in mdriven server.

URI prefix is not recognized when using WebClient with Unity WebGL

These code below will generate error "The URI prefix is not recognized", I already check the url,it's correct url format,it's my server url about upload function.
string url = "http://[skip]";
WebClient wc = new WebClient();
byte[] result = wc.UploadData(url,"PUT", data);
Error result in Chrome Developer console is below:
NotSupportedException: The URI prefix is not recognized.
at System.Net.WebRequest.Create (System.Uri requestUri, System.Boolean useUriBase) [0x00000] in <00000000000000000000000000000000>:0
Rethrow as WebException: An exception occurred during a WebClient request.
at System.Net.WebClient.UploadDataInternal (System.Uri address, System.String method, System.Byte[] data, System.Net.WebRequest& request) [0x00000] in <00000000000000000000000000000000>:0
(Filename: currently not available on il2cpp Line: -1)
warning: 2 FS.syncfs operations in flight at once, probably just doing extra work
Unity version:2018.1.0b13
Build platform:WebGL
API Compatibility Level: .Net 4.x
Scripting Runtime Version:Stable(.Net 4.x Equivalent)

PrimitiveResourceTypeMap throws exception when trying to use EF as data feed

Short description:
I'm trying to create a WFC data service that will use entity framework to retrieve data from db. The important thing is that the service must be hosted inside sharepoint server. Everything (almost) is ok except that when I'm trying to access deployed service from sharepoint I've got an exception:
The server encountered an error processing the request. The exception message is 'The type initializer for 'System.Data.Services.Providers.PrimitiveResourceTypeMap' threw an exception.'. See server logs for more details. The exception stack trace is:
at System.Data.Services.Providers.PrimitiveResourceTypeMap.get_TypeMap() at System.Data.Services.Providers.ObjectContextServiceProvider.PopulateMetadata(ProviderMetadataCacheItem metadataCacheItem) at System.Data.Services.Providers.BaseServiceProvider.LoadMetadata(Boolean skipServiceOperations) at System.Data.Services.Providers.EntityFrameworkDataService1.CreateInternalProvider(Object dataSourceInstance) at System.Data.Services.DataService1.CreateMetadataAndQueryProviders(IDataServiceMetadataProvider& metadataProviderInstance, IDataServiceQueryProvider& queryProviderInstance, Object& dataSourceInstance, Boolean& isInternallyCreatedProvider) at System.Data.Services.DataService1.CreateProvider() at System.Data.Services.DataService1.HandleRequest() at System.Data.Services.DataService`1.ProcessRequestForMessage(Stream messageBody) at SyncInvokeProcessRequestForMessage(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
The same service hosted from normal web app works fine.
Is there anyone that had similar issue and has some clues?
I managed to create fully functional WCF data service hosted inside SharePoint 2013 on premise. I got the exception mentioned in question (as well as many others).
By fully functional I mean that my odata requests with filters from CSOM and java script are properly executed and (auto-magically) results in properly formed queries to SQL server database. Works both http and https.
Here is short description what is necessary to have it all working.
A bunch of dll from nuget needs to be deployed to GAC via SharePoint WSP (here is list which worked for me)
a. EntityFramework.dll 6.1.3 for .Net 4.5
b. EntityFramework.SqlServer.dll 6.1.3 for .Net 4.5
c. Microsoft.Data.Edm.dll 5.6.2
d. Microsoft.Data.OData.dll 5.6.2
e. Microsoft.Data.Services.dll 5.6.2
f. Microsoft.Data.Services.Client.dll 5.6.2
g. Microsoft.OData.EntityFrameworkProvider.dll 1.0.0-beta2
h. System.Spatial.dll 5.6.2
Note: The trick is that there is no direct error that some of these dll’s are missing. The exception from question is displayed when there was no System.Spatial.dll in GAC.
Service should look similar to above:
using System.Data.Services;
using System.Data.Services.Providers;
using System.ServiceModel.Activation;
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class yourService : EntityFrameworkDataService<YourEntities>
{
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = System.Data.Services.Common.DataServiceProtocolVersion.V3;
}
}
Svc file: YourService.svc should be deployed to dedicated feature folder inside ISAPI SP folder
For http – fragment:
<service behaviorConfiguration="WCFServicesBehavior" name=" Namespace.yourservice ">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
For https: like in http but use mexHttpsBinding binding
Open your endpoint in browser to check if this is working
http://yoursite.local/_vti_bin/name_of_your_feature/yourservice.svc - should return info about service
http://yoursite.local/_vti_bin/name_of_your_feature/yourservice.svc/Name_of_your_entitySet() – should return all entities of given type
Check in SQL Server Profiler if your odata filters are properly translated to SQL queries

Xamarin PCL Unhandled Exception: TargetInvocationException

Im making an mobile application which can communicate with Dynamics AX using a WCF service.
Im fairly new to Xamarin, and im trying to create a PCL library for a shared IOS and Android application. Im also working on an Windows Phone App which pretty much works by now. Im using a WCF service ive created which does all the communication with Dynamics AX, and the service exposes its methods using Metadata. I've added a Service Reference to the Windows Phone solution and the generated Proxy works like a charm, i should say im using SOAP.
But if i transfer the generated Reference.cs file to my Xamarin PCL project and call my method the exact same way i get the following error:
Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.Serialization.SerializationException: Expected element 'ExceptionDetail' in namespace 'http://schemas.datacontract.org/2004/07/System.ServiceModel', but found Element node 'AifFault' in namespace 'http://schemas.microsoft.com/dynamics/2008/01/documents/Fault'
at System.Runtime.Serialization.XmlFormatterDeserializer.Deserialize (System.Xml.XmlReader reader, System.Type declaredType, System.Runtime.Serialization.KnownTypeCollection knownTypes, IDataContractSurrogate surrogate, System.Runtime.Serialization.DataContractResolver resolver, System.Runtime.Serialization.DataContractResolver defaultResolver, System.String name, System.String ns, Boolean verifyObjectName) [0x0003e] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/7.4.0.108/src/mono/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs:63
at System.Runtime.Serialization.DataContractSerializer.ReadObject (System.Xml.XmlDictionaryReader reader, Boolean verifyObjectName) [0x00024] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/7.4.0.108/src/mono/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs:363
at System.Runtime.Serialization.XmlObjectSerializer.ReadObject (System.Xml.XmlDictionaryReader reader) [0x00000] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/7.4.0.108/src/mono/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlObjectSerializer.cs:76
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x0019b] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/7.4.0.108/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:550
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00038] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/7.4.0.108/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:496
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x0001c] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/7.4.0.108/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:477
--- End of inner exception stack trace ---
The issue only occurs when AX return an AIFFault Exception and for some reason it cant be caught by Xamarin.. Its caught just fine in Visual Studio in Windows Phone.
Here is the code from making the call:
try{
var result = await _service.ExecuteGetMethod(MyRecord)
}
catch(FaultException fe){
ShowError(fe);
}
This works just fine, and the error message from AX is showed in fe.Message, but running the exact same in Xamarin gives me the above error.
Do i need to add AIFFault somewhere in my WCF service for clients to be able to see it?