Site published by WCF publishing wizard throws "Error in the application.." - wcf

I'm running BizTalk 2013r2 and run into a problem with the publishing wizard.
I have used the BizTalk WCF publish wizard, following the the steps:
Metadata only endpoint (MEX), publish for receive location
Publish schemas as a WCF service
Update the web service description tree view to give a single one-way web method
Give a target namespace (currently using http://tempuri.org/)
Enter location for website (is use localhost), select Overwrite existing location, Allow anonymous access
Generated service summary is below:
<?xml version="1.0" encoding="utf-16"?>
<WcfServiceDescription xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="BizTalkWcfService" TargetNamespace="http://tempuri.org/" xmlns="http://schemas.microsoft.com/BizTalk/2006/01/Adapter/Wcf/Publishing">
<LocationSettings Location="http://localhost/BTS-Store6" Overwrite="true" AuthAnonymous="true" />
<ApplicationSettings CreateReceiveLocations="false" ApplicationName="" />
<AdapterSettings AdapterName="" />
<MetadataSettings EnableMetadata="false" MetadataOnly="true" ReceiveLocationName="RcvStore6POS_WCF" />
<WcfServices>
<WcfService Name="OnRamp">
<WcfOperations>
<WcfOperation Name="POSTransaction" Flow="OneWay">
<WcfMessages>
<WcfMessage Name="Request" Direction="Input">
<WcfMessageType Category="XsdType" TypeName="BTS.GO.Store6.Schemas.BT.POSTranaction" AssemblyName="BTS.GO.Core.Store6.Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0a9764041befeb8b" AssemblyLocation="C:\Windows\Microsoft.Net\assembly\GAC_MSIL\BTS.GO.Core.Store6.Schemas\v4.0_1.0.0.0__0a9764041befeb8b\BTS.GO.Core.Store6.Schemas.dll" TargetNamespace="http://BTE.ESB.StoreInputModel.POSTransaction" RootName="POS" IsAnyType="false" IsEnvelope="false" />
</WcfMessage>
</WcfMessages>
</WcfOperation>
</WcfOperations>
</WcfService>
</WcfServices>
</WcfServiceDescription>
Problem is, after publish the site, I can browse to the .svc, and use WCF storm to consume the WSD - all is good. However, after leaving it for about 30 minutes - when I next try to access the service the following error is thrown:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="System.ServiceModel 4.0.0.0"/>
<EventIDQualifiers="49154">3</EventID>
<Level>2</Level>
<Task>5</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2015-01-12T12:26:41.000000000Z"/>
<EventRecordID>293995</EventRecordID>
<Channel>Application</Channel>
<Computer>000alien004.gooutdoors.local</Computer>
<Security UserID="S-1-5-21-1638455640-2704731959-1606034848-1010"/>
</System>
<EventData>
<Data>System.ServiceModel.Activation.HostedHttpRequestAsyncResult/11812267</Data>
<Data>System.ServiceModel.ServiceActivationException: The service '/BTS-Store6/OnRamp.svc' cannot be activated due to an exception during compilation. The exception message is: Error in the application.. ---> System.ApplicationException: Error in the application. at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() at Microsoft.BizTalk.Adapter.Wcf.Metadata.ConfigurationInfo.GetReceiveLocation(String receiveLocationName) at Microsoft.BizTalk.Adapter.Wcf.Metadata.MexServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) --- End of inner exception stack trace --- at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)</Data>
<Data>w3wp</Data>
<Data>21772</Data>
</EventData>
</Event>
With an exception message as vague as "Error in the application.." I'm at a loss as to what may be causing this. I have tried this many times. Usually, but not always, after republishing the site from the wizard I am able to browse to the service. The later, with semmingly only elapsed time being a changing factor, it fails.
Any ideas?

Related

Could not load type ImageResizer.InterceptModule

ImageResizer is setup and working in our test and development environments, however we can not get it working in our production environment. I have setup the IIS site the same (except for the name etc) and have the same Web.config options (only ImageResizer related things in there).... and no dice. We keep getting the error below. We have already tried re-downloading the files, and we checked the other suggestions. All to no avail.
.NET Version 4.5.2.
dll version 4.0.4.934 (we also tried with 4.0.5)... same result.
At the very bottom of the error page, the following displays... which may explain things? .NET 4.5.2 is on the server but it looks like the site is not configured to use it, perhaps?:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34274
Server Error in '/' Application.
Could not load type 'ImageResizer.InterceptModule'.
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.Web.HttpException: Could not load type 'ImageResizer.InterceptModule'.
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:
[HttpException (0x80004005): Could not load type 'ImageResizer.InterceptModule'.]
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +12512121
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +76
[ConfigurationErrorsException: Could not load type 'ImageResizer.InterceptModule'.]
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +12425644
System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +69
System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +62
System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +299
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1262
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +133
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475
[HttpException (0x80004005): Could not load type 'ImageResizer.InterceptModule'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12618980
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12458597
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="resizer" type="ImageResizer.ResizerSection,ImageResizer" requirePermission="false" />
</configSections>
<resizer>
<!-- Unless you (a) use Integrated mode, or (b) map all requests to ASP.NET,
you'll need to add .ashx to your image URLs: image.jpg.ashx?width=200&height=20 -->
<pipeline fakeExtensions=".ashx" defaultCommands="autorotate.default=true" />
<diskcache dir="/cache" />
<plugins>
<add name="DiskCache" />
<!-- <add name="PrettyGifs" /> -->
<!-- <add name="SimpleFilters" /> -->
<!-- <add name="S3Reader" /> -->
</plugins>
</resizer>
<system.web>
<httpModules>
<!-- This is for IIS7/8 Classic Mode and Cassini-->
<add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<!-- This is for IIS7/8 Integrated mode -->
<add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</modules>
</system.webServer>
</configuration>
Additional Error Info...
Could not load file or assembly 'ImageResizer' or one of its dependencies. The system cannot find the file specified.
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.IO.FileNotFoundException: Could not load file or assembly 'ImageResizer' or one of its dependencies. The system cannot find the file specified.
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.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'ImageResizer' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Even though our test environment has the "bin" folder setup as a virtual directory in IIS, this did not work in our production environment. It most likely has to do with the way the drives and site roots and content are setup and stored.
Test VM:
IIS Site Root -> X:\some.site\wwww
"bin" virtual directory -> Y:\bin
Prod VM:
Does not work:
IIS Site Root -> X:\some.site\wwww (which is a symlink to a SAN share)
"bin" virtual directory -> C:\bin
Works:
"bin" is a directory in the site root (on the SAN share)
Thanks Nathanael for the help.
For my case, I accidentally changed the directory of the Default Website on IIS to the root folder of one of my projects whose web.config file includes the ImageResizingModule.
I fixed the issue by just changing the physical path of the Default Website on IIS to the wwwroot folder.

FileLoadException during activation of WCF service

After deploying my WCF service in IIS, I get this error when accessing the service:
Server Error in '/MyService' Application.
The given assembly name or codebase was invalid. (Exception from
HRESULT: 0x80131047) 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.IO.FileLoadException: The given assembly
name or codebase was invalid. (Exception from HRESULT: 0x80131047)
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:
[FileLoadException: The given assembly name or codebase was invalid.
(Exception from HRESULT: 0x80131047)]
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean
loadTypeFromPartialName, ObjectHandleOnStack type) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean
loadTypeFromPartialName) +153 System.Type.GetType(String typeName)
+89 System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +936
System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo
serviceActivationInfo, EventTraceActivity eventTraceActivity) +76
System.ServiceModel.HostingManager.EnsureServiceAvailable(String
normalizedVirtualPath, EventTraceActivity eventTraceActivity) +901
[ServiceActivationException: The service '/MyService/MySvcImpl.svc'
cannot be activated due to an exception during compilation. The
exception message is: The given assembly name or codebase was invalid.
(Exception from HRESULT: 0x80131047).]
System.Runtime.AsyncResult.End(IAsyncResult result) +650220
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult
result) +210733
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult
ar) +166
I turned on the Assembly Binding Log Viewer (FUSLOGVW.EXE), but it does not show me any binding failures. Anyone any idea what could cause this, or how to debug this?
Found the issue! Posting here as it may help someone someday.
My web.config contains a service activation element with a factory attribute like this:
<serviceHostingEnvironment>
<serviceActivations>
<add relativeAddress="MyService.SvcImpl.svc"
service="MyService.SvcImpl"
factory="MyCompany.MyServiceHostFactory, MyCompany.MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" />
</serviceActivations>
</serviceHostingEnvironment>
The factory attribute contains a class reference from a strongly named assembly. However, the PublicKeyToken atribute was supposed to be set by the build system to the correct value, depending on whether a test signing cert or the official signing cert was used.
The build step somehow failed and left the strong name of the assembly invalid. So, the first part of the message in the exception was pretty acurate. It just did not tell me which assembly could not be loaded. Nor was FUSLOGVW.EXE any helpful here.
I have the same problem when I tried to reference a file in this location 'AppCode/Authentication' but when I changed the name of the folder to 'App_Code/Authentication' the problem was resolved.

debugging Silverlight WCF RIA app; "Load operation failed for query 'GetTblProjects'. The remote server returned an error: NotFound."

Presently I am building a Silverlight WCF RIA application. It has been going well, with the client obtaining the data it needs without a problem. Then I decided to add a table to the database, update the associated Entity Data Model EDMX file, and re-generated the associated Domain Service class. Now it still gets all the tables it used to get with no problem, but when I try to obtain data from the new table tblProject, I'm receiving this error:
Error
Load operation failed for query 'GetTblProjects'. The remote server returned an error: NotFound.
Error Details
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
Caused by: The remote server returned an error: NotFound.
at System.ServiceModel.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
Caused by: The remote server returned an error: NotFound.
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
Caused by: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClassa.<EndGetResponse>b__9(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
I've spent a lot of time looking at the domain service class, along with the XAML code and the associated view model class, and can't see any differences between the implementation related to, say, the tblBasin database table that works fine with no problems and the new tblProject table that is giving me the error. When I turn on WCF tracing, here is what I get for the tblBasin:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>458758</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2012-04-20T21:54:03.3280726Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{169c9eeb-338f-4ea5-a93a-34f234113283}" />
<Execution ProcessName="WebDev.WebServer40" ProcessID="5276" ThreadID="14" />
<Channel/>
<Computer>WKSTCAL0123</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/en-CA/library/System.ServiceModel.Security.SecurityImpersonationSuccess.aspx</TraceIdentifier>
<Description>Security Impersonation succeeded at the server.</Description>
<AppDomain>f8f8d82-2-129794323085920534</AppDomain>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/SecurityImpersonationTraceRecord">
<OperationAction>http://tempuri.org/ProjectSetDomainServicebinary/GetTblBasins</OperationAction>
<OperationName>GetTblBasins</OperationName>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
Here is what I get for the tblProject table data that fails:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>262163</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2012-04-20T21:54:03.3270721Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{30c0de8a-fd38-4ca6-8c8a-b88f27a783bf}" />
<Execution ProcessName="WebDev.WebServer40" ProcessID="5276" ThreadID="12" />
<Channel/>
<Computer>WKSTCAL0123</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/en- CA/library/System.ServiceModel.Channels.MessageReceived.aspx</TraceIdentifier>
<Description>Received a message over a channel.</Description>
<AppDomain>f8f8d82-2-129794323085920534</AppDomain>
<Source>System.ServiceModel.Activation.HostedHttpContext+HostedHttpInput/61784148</Source>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTransmitTraceRecord">
<MessageProperties>
<AllowOutputBatching>False</AllowOutputBatching>
<Via>http://localhost:57671/Services/ZEGApps-Web-Services-ProjectSetDomainService.svc/binary/GetTblProjects</Via>
</MessageProperties>
<MessageHeaders>
<To d4p1:mustUnderstand="1" xmlns:d4p1="http://schemas.microsoft.com/ws/2005/05/envelope/none" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:57671/Serv ices/ZEGApps-Web-Services-ProjectSetDomainService.svc/binary/GetTblProjects</To>
</MessageHeaders>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
Does anyone have any suggestions on how to resolve this issue? TIA.
UPDATE: All service calls are succeeding except the call to obtain data from the new tblProject database table I created.
I know this sounds pretty basic, but your question doesn't mention this information and the problem sounds very much like this could be your answer:
Have you updated the appropriate executable files on the server? If you updated only the client code with the knowledge of the new table, the server would behave this way.
Thank you so much for your reply, John!
Presently, the application is in pretty early development stages, so I am actually testing it using the Visual Studio Cassini web server. Both the client and the server projects are in the same solution. So when I rebuild the application, it should rebuild the associated XAP file, shouldn't it? This is what the timestamp for the file indicates. BTW, the SQL Server database is running on a separate database server.
Also, when I open and inspect the EDMX file, it shows the tblProject table as I expect.
If there is anything else I may have missed or you have any other suggestions, they are most welcome.
(Don't know if this still an open question...)
Have you tried using Fiddler and making your remote call ? Sometimes an error occurs on the server and an error page is returned to the client. As RIA Services handles the call, you just get a generic error message.
If your dev server is on localhost, please remember to use "localhost." (with the point) to have the call intercepted by Fiddler.

Why Enterprise Library does not throw FaultException in WCF

I use WCF service hosted on IIS.
Also, I use fault contracts to send errors to the client (FaultException<'T>)
On the client side I catch FaultException<'T> to show some error to user.
If some unhandled exception being thrown on a server, WCF generates plain FaultException,
so client catches it and shows user "Internal Server Error" message.
Then I began to use Enterprise Library 5.0 for WCF Exception Shielding, and met following issue. Using FaultContractExceptionHandler it is possible to carry all errors to the client, but in case of unhandled exception client receives CommunicationException instead of FaultException. Everything other works ok.
If I turned off exception handling policy (remove ExceptionShielding attibute), client catches FaultExceptions as expected.
Do you know what may be the reason?
Thanks.
PS: Here is a chain of inner exceptions:
CommunicationException -> WebException -> IOException -> SocketException
Message is "The underlying connection was closed: A connection that was expected to be kept alive was closed by the server."
Web.config
<add name="ServiceException Policy">
<exceptionTypes>
<add name="ServiceLogicException" type="LopService.Contracts.ServiceLogicException, LopService.Contracts, Version=1.0.0.1725, Culture=neutral, PublicKeyToken=null"
postHandlingAction="ThrowNewException">
<exceptionHandlers>
<add type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF.FaultContractExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
faultContractType="LopService.Contracts.ServiceLogicFaultContract, LopService.Contracts, Version=1.0.0.1725, Culture=neutral, PublicKeyToken=null"
name="Fault Contract Exception Handler" />
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
Service Class
[ExceptionShielding("ServiceException Policy")]
public partial class LopSoapService
{...
Operation Contract
[OperationContract]
[FaultContract(typeof(DataValidationFaultContract))]
[FaultContract(typeof(ServiceLogicFaultContract))]
int CreateUser(UserDto userDto, IEnumerable<ClaimRecordDto> claimRecords);
This appears to be an issue with Enterprise Library. See this workitem.

Getting debug output from WCF 4 REST Template

I'm trying to see the exception that's being thrown in my WCF service but all I get from the response is:
"The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs."
Since I'm doing it the "REST" way, I don't have these options in my web.config. So, how can I enable "IncludeExceptionDetailInFaults" when using the WCF 4 REST Template?
Here's what I came up with:
Under the standardEndpoint in your web.config, turn on faultExceptionEnabled
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" faultExceptionEnabled="true">
Then, for custom messages to show, the thrown exceptions must be a FaultException. Here's an example of one that I use:
if (!Enum.GetNames(typeof(Models.Games.GsfCurrencyPrice.Sections)).Contains(section)) throw new FaultException<ArgumentException>(new ArgumentException("Value must be one of the following: " + string.Join(", ", Enum.GetNames(typeof(Models.Games.GsfCurrencyPrice.Sections))), "section"));
which produces the following response when thrown:
<Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none"><Code><Value>Sender</Value></Code><Reason><Text xml:lang="en-US">The creator of this fault did not specify a Reason.</Text></Reason><Detail><ArgumentException xmlns="http://schemas.datacontract.org/2004/07/System" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="http://www.w3.org/2001/XMLSchema"><ClassName i:type="x:string" xmlns="">System.ArgumentException</ClassName><Message i:type="x:string" xmlns="">Value must be one of the following: Buy, Sell</Message><Data i:nil="true" xmlns=""/><InnerException i:nil="true" xmlns=""/><HelpURL i:nil="true" xmlns=""/><StackTraceString i:nil="true" xmlns=""/><RemoteStackTraceString i:nil="true" xmlns=""/><RemoteStackIndex i:type="x:int" xmlns="">0</RemoteStackIndex><ExceptionMethod i:nil="true" xmlns=""/><HResult i:type="x:int" xmlns="">-2147024809</HResult><Source i:nil="true" xmlns=""/><WatsonBuckets i:nil="true" xmlns=""/><ParamName i:type="x:string" xmlns="">section</ParamName></ArgumentException></Detail></Fault>
Hope this helps.