I have two WebServices. One service is using the wsHttpBinding and other is using basicHttpBinding. Exception handling is working fine in wsHttpBinding but is failing for basicHttpBinding. I am using basicHttpBinding because this is a WebService defined for streaming the file download. When i throw a FaultException<FileDownloadFault> from my Server code it is reaching the client as following:The content type text/html of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml"). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/><title>500 - Internal server error.</title><style type="text/css"><!--body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}fieldset{padding:0 15px 10px 15px;} h1{font-size:2.4em;margin:0;color:#FFF;}h2{font-size:1.7em;margin:0;color:#CC0000;} h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} #header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;background-color:#555555;}#content{margin:0 0 0 2%;position:relative;}.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}--></style></head><body><div id="header"><h1>Server Error</h1></div><div id="content"> <div class="content-container"><fieldset> '.This is how i throw the error from webservice:throw new FaultException<FileDownloadFault>(new FileDownloadFault() { errorMessage = "Requested file not found on the server" }, new FaultReason("FileNotFound"));My Fault class has nothing special but only generice error code and message: [DataContract(Namespace = "http://mynamespace/data")] public class FileDownloadFault { /// <summary> /// error code related to the fault /// </summary> [DataMember] public int errorCode { get; set; } /// <summary> /// error message related to the fault /// </summary> [DataMember] public string errorMessage { get; set; } /// <summary> /// Default Contract /// </summary> public FileDownloadFault() { } }Following are the binding settings:<?xml version="1.0"?><configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> <services> <service name="MyService" behaviorConfiguration="MyServiceBehavior"> <endpoint contract="IMyService" binding="basicHttpBinding" bindingConfiguration="MyServiceBinding" bindingNamespace="http://mynamespace/myservice"/> </service> </services> <bindings> <basicHttpBinding> <binding name ="MyServiceBinding" transferMode="Streamed" messageEncoding="Mtom" maxReceivedMessageSize="100485760" > <security mode="TransportWithMessageCredential" > <message clientCredentialType="UserName" /> </security> </binding> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="MyServiceBehavior"> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceMetadata httpsGetEnabled="true" /> <serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MyServiceAuthentication, AssemblyName" /> </serviceCredentials> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel></configuration>If i change the transfer mode to Buffered it works fine. but that is not desirable, as we don't want to use streaming. One weired thing is that - this works all fine if my client and server are running on the same machine. The exception is coming properly. But if i try to access the server from some other machine, i got that "500- Internal Server Error" rather than FileDownloadFault.Is it some configuration problem.. like customErrorMessage flag for ASP.NET?Please help me with this.
Product Version