Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 1.82 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. wcf error extension could not be loaded
  2. System.Configuration.ConfigurationErrorsException: The type 'InMotionGIT_NT.Address.Service, CustomHeaders, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' registered for extension 'customHeaders' could not be loaded. (C:UsersjmachadoDocumentsVisual Studio 2010ProjectsInMotionGIT_NTAddress ServiceInMotionGIT_NT.Address.ServicebinDebugInMotionGIT_NT.Address.Service.dll.config line 67)
  3.        
  4. <endpointBehaviors>
  5.     <behavior name="jsonBehavior">
  6.       <enableWebScript/>
  7.       <customHeaders/>
  8.       <!--<webHttp/>-->
  9.     </behavior>
  10.   </endpointBehaviors>
  11.        
  12. <behaviorExtensions>
  13.     <add name="customHeaders" type="InMotionGIT_NT.Address.Service, CustomHeaders, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  14.   </behaviorExtensions>
  15.        
  16. [AttributeUsage(AttributeTargets.Class)]
  17. public class CustomHeaders : IDispatchMessageInspector
  18. {
  19.  
  20.     public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext)
  21.     {
  22.         if ((WebOperationContext.Current.IncomingRequest.Method == "GET")) {
  23.             WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Origin", "*");
  24.             WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Methods", "POST");
  25.             WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Accept");
  26.         }
  27.         return null;
  28.     }
  29.  
  30.  
  31.     public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
  32.     {
  33.     }
  34. }
  35.        
  36. <behaviorExtensions>
  37.     <add name="customHeaders" type="InMotionGIT_NT.Address.Service.CustomHeaders, <DLLName> , Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  38. </behaviorExtensions>