Search Results

Search found 185 results on 8 pages for 'basichttpbinding'.

Page 6/8 | < Previous Page | 2 3 4 5 6 7 8  | Next Page >

  • WCF is throwing UnauthorizedAccessExceptyion after upgrade to .NET 4.0

    - by Andrey
    I have a pretty simple client-server ASP.NET app; communication is via WCF service. All worked perferctly inVS 2008, now I upgraded to VS2010 and every time the client code is trying to instantiate a channel to the server: new ChannelFactory<IMemberService>("Members.MemberService").CreateChannel(); it throws an UnauthorizedAccessException "Access denied". Were there any breaking changes in the new version, or do I need to add some configuration? I'm pretty stuck, any ideas would be highly appreciated! BTW, binding used is basicHttpBinding, i don't know if thats important here. Thank you, Andrey

    Read the article

  • C# WCF client configuration for X509 secured web service over https

    - by Kam
    Hi guys I been pulling my hair out for the past few days trying to connect to a web service using .Net 3.5 and WCF (have also tried using WSE 3.0) without much luck. The web service is hosted by a 3rd party and we can access via https. They also make use of X509 certificates for security, to sign the message. I've been given some basic info and am able to connect and test the service using SOAP UI 3.5 without any problems, so we know that this is not the issue. Just trying to get it done in code! I've added the X509 certificate into the certificate store using the mmc snap-in, and using tracing and logging i can see that the message is being signed, just unable to see which part i have got wrong. Any healp GREATLY appreciated :) I've been given an offline WSDL file, which I have imported in as a service reference is VS 2008. My calling code looks like so, simple enough: ServicePointManager.ServerCertificateValidationCallback = delegate(object sender,X509Certificate certificate,X509Chain chain, SslPolicyErrors sslErrors) { return true; }; GatewayClient gateway = new GatewayClient(); CheckStatusResponse response = gateway.CheckLineStatus(); And my config looks like so: <basicHttpBinding> <binding name="Gateway_1.0" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="TransportWithMessageCredential"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="Certificate" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> <customBinding> <binding name="Gateway_1"> <security authenticationMode="CertificateOverTransport" includeTimestamp="true" messageProtectionOrder="SignBeforeEncrypt"> <localClientSettings maxClockSkew="12:00:00" replayWindow="12:00:00" sessionKeyRolloverInterval="12:00:00" timestampValidityDuration="12:00:00" /> <localServiceSettings maxClockSkew="12:00:00" sessionKeyRolloverInterval="12:00:00" timestampValidityDuration="12:00:00" /> <secureConversationBootstrap /> </security> <textMessageEncoding messageVersion="Soap11" /> <sslStreamSecurity requireClientCertificate="true" /> <httpsTransport hostNameComparisonMode="WeakWildcard" /> </binding> </customBinding> <wsHttpBinding> <binding name="Gateway_1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <security mode="TransportWithMessageCredential"> <message clientCredentialType="Certificate" negotiateServiceCredential="false" establishSecurityContext="true" /> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="https://XXX.XX.XXX.XX/SOAP" behaviorConfiguration="ClientCertificateBehavior" binding="wsHttpBinding" bindingConfiguration="Gateway_1" contract="B2BService.Gateway" name="Gateway_1_HTTPSPort"> <identity> <dns value="ext.test.com" /> </identity> </endpoint> </client> <behaviors> <endpointBehaviors> <behavior name="ClientCertificateBehavior"> <clientCredentials> <clientCertificate findValue="mycertificate.com" storeLocation="CurrentUser" storeName="Root" x509FindType="FindBySubjectName" /> <serviceCertificate> <authentication certificateValidationMode="PeerOrChainTrust" /> </serviceCertificate> </clientCredentials> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel> Regardless of which config I use, the code fails for one reason or another, causing internal server errors, Error processing message for security, Undefined 'badEncoding' resource property, or expected http URI given https, and a few other! Been going round and round a bit, and I am sure it is very simple once the cofig is set :( I'm sure I've missed loads out, let me know if seeing the SOAP UI generated envelope and the currect WCF generated envelope will help. many thanks. Kam

    Read the article

  • WCF using REST, having some binding questions

    - by netlogging
    Hello people, I am really confused right now and I can't get any right answers anywhere. My confusions are: 1) Isn't wsHttpBinging (which is beefed up basicHttpBinding) used in SOAP instead of REST and REST only uses webHttpBinding? 2) Also, DOES silverlight 4 with WCF (REST) support wsHttpBinding (VS2010)? I read that it does not everywhere on the net but I some how got silverlight 4 working with REST using wsHttpBinding. NOTE: I am using Factory="System.ServiceModel.Activation.WebServiceHostFactory". Is this factory setting somehow bypassing my web.config setting for wsHttpBinding to make it work with webHttpBinding and i am thinking by my wsHttpBinding is working? Thank you.

    Read the article

  • WCF - Network Cost

    - by Mubashar Ahmad
    Dear Devs I have a wcf service deployed on IIS with basicHttpBinding and aspNetCompatibilityEnabled=true I have a test client as well which invokes multiple service functions simultaneously. To check the performance of service call on client and server I calculated the Avg time it takes to complete a service request on client(in proxy code) and on server as well. after a test of 8 hrs (server and client were on the same machine) i came to know that average response time on client is around 34ms where as the Avg execution time on server is around 3ms so the difference is 31ms. I would like to know why every call is taking 31ms is it justified? and how can i reduce this?

    Read the article

  • The remote server returned an error: (400) Bad Request - uploading less 2MB file size?

    - by fiberOptics
    The file succeed to upload when it is 2KB or lower in size. The main reason why I use streaming is to be able to upload file up to at least 1 GB. But when I try to upload file with less 1MB size, I get bad request. It is my first time to deal with downloading and uploading process, so I can't easily find the cause of error. Testing part: private void button24_Click(object sender, EventArgs e) { try { OpenFileDialog openfile = new OpenFileDialog(); if (openfile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string port = "3445"; byte[] fileStream; using (FileStream fs = new FileStream(openfile.FileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { fileStream = new byte[fs.Length]; fs.Read(fileStream, 0, (int)fs.Length); fs.Close(); fs.Dispose(); } string baseAddress = "http://localhost:" + port + "/File/AddStream?fileID=9"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(baseAddress); request.Method = "POST"; request.ContentType = "text/plain"; //request.ContentType = "application/octet-stream"; Stream serverStream = request.GetRequestStream(); serverStream.Write(fileStream, 0, fileStream.Length); serverStream.Close(); using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { int statusCode = (int)response.StatusCode; StreamReader reader = new StreamReader(response.GetResponseStream()); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } Service: [WebInvoke(UriTemplate = "AddStream?fileID={fileID}", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare)] public bool AddStream(long fileID, System.IO.Stream fileStream) { ClasslLogic.FileComponent svc = new ClasslLogic.FileComponent(); return svc.AddStream(fileID, fileStream); } Server code for streaming: namespace ClasslLogic { public class StreamObject : IStreamObject { public bool UploadFile(string filename, Stream fileStream) { try { FileStream fileToupload = new FileStream(filename, FileMode.Create); byte[] bytearray = new byte[10000]; int bytesRead, totalBytesRead = 0; do { bytesRead = fileStream.Read(bytearray, 0, bytearray.Length); totalBytesRead += bytesRead; } while (bytesRead > 0); fileToupload.Write(bytearray, 0, bytearray.Length); fileToupload.Close(); fileToupload.Dispose(); } catch (Exception ex) { throw new Exception(ex.Message); } return true; } } } Web config: <system.serviceModel> <bindings> <basicHttpBinding> <binding> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="2097152" maxBytesPerRead="4096" maxNameTableCharCount="2097152" /> <security mode="None" /> </binding> <binding name="ClassLogicBasicTransfer" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:15:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="67108864" maxReceivedMessageSize="67108864" messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="67108864" maxBytesPerRead="4096" maxNameTableCharCount="67108864" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> <binding name="BaseLogicWSHTTP"> <security mode="None" /> </binding> <binding name="BaseLogicWSHTTPSec" /> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true" /> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> </system.serviceModel> I'm not sure if this affects the streaming function, because I'm using WCF4.0 rest template which config is dependent in Global.asax. One more thing is this, whether I run the service and passing a stream or not, the created file always contain this thing. How could I remove the "NUL" data? Thanks in advance. Edit public bool UploadFile(string filename, Stream fileStream) { try { FileStream fileToupload = new FileStream(filename, FileMode.Create); byte[] bytearray = new byte[10000]; int bytesRead, totalBytesRead = 0; do { bytesRead = fileStream.Read(bytearray, totalBytesRead, bytearray.Length - totalBytesRead); totalBytesRead += bytesRead; } while (bytesRead > 0); fileToupload.Write(bytearray, 0, totalBytesRead); fileToupload.Close(); fileToupload.Dispose(); } catch (Exception ex) { throw new Exception(ex.Message); } return true; }

    Read the article

  • WCF: limit number of calls per hour - per user

    - by Eric Eijkelenboom
    Hi guys, I've got a WCF service (basicHttpBinding, basic authentication, IIS 6.0) on which I want to restrict the number of calls per hour - on user basis. For example, max 1000 calls per user, per hour (a la Google Maps, etc). I also want to implement some sort of subscription mechanism, so that users can upgrade their call-limit across various 'price plans'. I know that I could achieve this with a custom Inspector, backed by a DB containing some sort of 'subscription' table and a counter, but I'd like to avoid reinventing the wheel. Does anyone have experience doing this? Are there 3rd party projects/libraries that support this out of the box? Thanks. Eric

    Read the article

  • Web Service URL change is not recognized

    - by ila
    I deployed in a production environment a .net solution that consumes a web service added as "Service reference" in visual studio. Today the endpoint URL has changed, and I modified that URL in web.config. But when I run the solution I get the error: System.ServiceModel.FaultException: Server did not recognize the value of HTTP Header SOAPAction: http://93.62.150.200/LogEvent. Now that sound strange to me. As you can see, the IP is 93.62.... but the new value is different. The web.config entry (with the new value or the URL) is: <client> <endpoint address="http://213.92.50.215/sawfc/WS_SAWFC_Int.asmx" binding="basicHttpBinding" bindingConfiguration="wsSAWFCInterfaceSoap" contract="it.datasphere.ws.wsSAWFCInterfaceSoap" name="wsSAWFCInterfaceSoap" /> </client> I cannot reach the new web service from dev environment, so I cannot modify the Service reference there. Any idea? Thanks a lot!

    Read the article

  • EndpointNotFoundException when working through tutorials in Learning WCF

    - by Nicholas
    I am working through the book Learning WCF and on the first tutorial lab HelloIndigo I am receiving the following error. Could not connect to http://localhost:8000/HelloIndigo/HelloIndigoService. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8000. It appears in the Client project on the line string s = proxy.HelloIndigo(); EndpointAddress ep = new EndpointAddress("http://localhost:8000/HelloIndigo/HelloIndigoService"); IHelloIndigoService proxy = ChannelFactory<IHelloIndigoService>. CreateChannel(new BasicHttpBinding(), ep); string s = proxy.HelloIndigo(); Console.WriteLine(s); Console.WriteLine("Press <ENTER> to terminate Client"); Console.ReadLine(); I have intensively googled on this but I am none the wiser. Can anyone explain the issue and how to remedy?

    Read the article

  • call WCF Service from SSL Enabled website

    - by Usama Khalil
    how can i call service from a ssl enabled website to a WCF service with basicHTTPBinding. i am getting the error The requested service, 'http://10.5.1.111/HRMSService/VehicleMaintenance/VehicleMaintenance.svc/test' could not be activated. See the server's diagnostic trace logs for more information. 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.ServiceModel.ServiceActivationException: The requested service, 'http://10.5.1.111/HRMSService/VehicleMaintenance/VehicleMaintenance.svc/test' could not be activated. See the server's diagnostic trace logs for more information. 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

    Read the article

  • Could not find default endpoint element

    - by edosoft
    I've added a proxy to a webservice to a VS2008/.NET 3.5 solution. When constructing the client .NET throws this error: Could not find default endpoint element that references contract 'IMySOAPWebService' in the service model client configuaration section. This might be because no configuaration file was found for your application or because no end point element matching this contract could be found in the client element Searching for this error tells me to use the full namespace in the contract. Here's my app.config with full namespace: <client> <endpoint address="http://192.168.100.87:7001/soap/IMySOAPWebService" binding="basicHttpBinding" bindingConfiguration="IMySOAPWebServicebinding" contract="Fusion.DataExchange.Workflows.IMySOAPWebService" name="IMySOAPWebServicePort" /> </client> I'm running XP local (I mention this because a number of Google hits mention win2k3) The app.config is copied to app.exe.config, so that is also not the problem. Any clues?

    Read the article

  • Compressing as GZip WCF requests (SOAP and REST)

    - by Joannes Vermorel
    I have a .NET 3.5 web app hosted on Windows Azure that exposes several WCF endpoints (both SOAP and REST). The endpoints typically receive 100x more data than they serve (lot of data is upload, much fewer is downloaded). Hence, I am willing to take advantage from HTTP GZip compression but not from the server viewpoint, but rather from the client viewpoint, sending compressed requests (returning compressed responses would be fine, but won't bring much gain anyway). Here is the little C# snippet used on the client side to activate WCF: var binding = new BasicHttpBinding(); var address = new EndpointAddress(endPoint); _factory = new ChannelFactory<IMyApi>(binding, address); _channel = _factory.CreateChannel(); Any idea how to adjust the behavior so that compressed HTTP requests can be made?

    Read the article

  • Using WCF HttpBindings on a LAN

    - by dcw
    We have a WCF-based client server that operates over a LAN. We've been getting along ok by using the NetTcpBinding, chosen because we couldn't get either HttpBinding to work between hosts. (Within a single host works fine, but is not useful for the production environment.) We're now back at the point where we want to explore using either BasicHttpBinding or WsHttpBinding, but we simply can't see the server from the client: even putting in the path to the endpoint into IE fails to see the server. Is there something simple we've overlooked? We're not specifying any security settings (or anything else, for that matter). Should we be doing so (e.g. explicitly setting security settings to None)?

    Read the article

  • Using Sessions in WCF Services called from Silverlight

    - by Torbjörn Josefsson
    (Using Visual Studio 2008, and Silverlight 3) -I've really looked around for this one, and now I'm just confused by all the solutions that simply won't work for me. I'm trying to call a WCF service from a Silverlight client, which is no problem, but I can't get the service to handle sessions (I want to remember a few things about the callee between calls) I've gathered that basicHttpBinding is no good for sessions, and I haven't managed to make wsHttpBinding work... what's the matter? I would have thought this was a pretty basic thing people would want in their WCF services, or am I just completely muddle-headed not to see how it can be done?

    Read the article

  • Consuming WCF REST service in multiple ways (.Net, plain XML)

    - by Jan Jongboom
    I have become quite frustrated of WCF as I just want to use this simple scenario: Provide a webservice using REST, with a UriTemplate like /method/{param1}/{param2}/ and a 3th parameter that is sent to the service as XML as POST data. Use just plain XML, no SOAP overhead. Be able to generate a proxy in Visual Studio so a .Net using client can easily use the service (don't care about SOAP overhead here). I can create 1. and 2. but no way I can use 3. I tried adding both webHttpBinding and basicHttpBinding endpoints in my services config; I fooled around with the <services/> tag, but I just can't get this working. What am I missing here?! N.B. I checked out this article: http://stackoverflow.com/questions/186631/rest-soap-endpoints-for-a-wcf-service but nothing what is described there seems to work here?!

    Read the article

  • Is there an example of checking on if a WCF Service is online?

    - by apolfj
    I will have a client application using a proxy to a WCF Service. This client will be a windows form application doing basicHttpBinding to N number of endpoints at an address. The problem I want to resolve is that when any windows form application going across the internet to get my web server that must have my web server online will need to know that this particular WCF Service is online. I need an example of how this client on a background thread will be able to do a polling of just "WCF Service.., Are You There?" This way our client application can notify clients before they invest a lot of time in building up work client-side to only be frustrated with the WCF Service being offline. Again I am looking for a simple way to check for WCF Service "Are You There?"

    Read the article

  • How to programmatically generate WSDL from WCF service (Integration Testing)

    - by David Christiansen
    Hi All, I am looking to write some integration tests to compare the WSDL generated by WCF services against previous (and published) versions. This is to ensure the service contracts don't differ from time of release. I would like my tests to be self contained and not rely on any external resources such as hosting on IIS. I am thinking that I could recreate my IIS hosting environment within the test with something like... using (ServiceHost host = new ServiceHost(typeof(NSTest.HelloNS), new Uri("http://localhost:8000/Omega"))) { host.AddServiceEndpoint(typeof(NSTest.IMy_NS), new BasicHttpBinding(), "Primary"); ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); behavior.HttpGetEnabled = true; host.Description.Behaviors.Add(behavior); host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); host.Open(); } Does anyone else have any better ideas?

    Read the article

  • Can phper give me some code snippet to consume the .net wcf service

    - by Vincent
    Hi, I can successfully make a call to wcf from php without WCF message security enabled. I search the whole forum and cannot find any clue. I'd like to know how can I pass the credential ? My WCF service use the basichttpbinding on SSL with Message security enabled. Here is my code snippet to call my wcf from .NET ServiceReference1.TestClient sc = new TestClient(); sc.ClientCredentials.UserName.UserName = "[email protected]"; sc.ClientCredentials.UserName.Password = "ABC123"; Console.WriteLine(sc.GetProfiledSchemas(412));

    Read the article

  • WCF host address question

    - by Estelle
    when I setup the wcf service on a web server, I set the end point address as <endpoint address="http://www.mydomin.com/clientname/happy.svc" binding="basicHttpBinding" name="happysvcbasic" contract="happysvc.Ihappysvc"> </endpoint> but when type in above address on a browser, I get a different host name, which is the internal server name, such as, To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: svcutil.exe http://internalservername.domain/clientname/happy.svc?wsdl I tried to add the host/baseaddress tag, but make no difference, what I missed? thanks for help.

    Read the article

  • There was no endpoint listening at http://localhost:49481/Marketing.svc that could accept the message

    - by duckmike
    I have a Marketing service running locally through port 49481 and through IIS on port 65000. Either way when I try to debug into that service, I get an error message - {"There was no endpoint listening at http:/localhost:49481/Marketing.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."} My inner exception is - {"The remote server returned an error: (404) Not Found."} I can open that service address, http:/localhost:49481/Marketing.svc, through a browser and I get a message that it's running ok. My config file is set up like - <endpoint address="http://localhost:49481/Marketing.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMarketing" contract="SunriseMarketing.IMarketing" name="BasicHttpBinding_IMarketing" /> What am I missing?

    Read the article

  • Webservice parameter value encoding

    - by dnolan
    We have a webservice created in WCF and presenting itself as a basicHttpBinding. One of the parameters is a string which takes an xml string. Looking at the soap the client generates to send to the webservice, the xml is encoded, with all < and swapped into < and >. My question is, is this all that is encoded, or has the parameter been run through HtmlEncode so that other entities would be swapped also? The reason I ask is we are submitting with our client to a 3rd party webservice now and they would like to know the details on what is encoded.

    Read the article

  • WCF Service returning 400 error: The body of the message cannot be read because it is empty

    - by Josh
    I have a WCF service that is causing a bit of a headache. I have tracing enabled, I have an object with a data contract being built and passed in, but I am seeing this error in the log: <TraceData> <DataItem> <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"> <TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier> <Description>Throwing an exception.</Description> <AppDomain>efb0d0d7-1-129315381593520544</AppDomain> <Exception> <ExceptionType>System.ServiceModel.ProtocolException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> <Message>There is a problem with the XML that was received from the network. See inner exception for more details.</Message> <StackTrace> at System.ServiceModel.Channels.HttpRequestContext.CreateMessage() at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback) at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state) at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) </StackTrace> <ExceptionString> System.ServiceModel.ProtocolException: There is a problem with the XML that was received from the network. See inner exception for more details. ---&amp;gt; System.Xml.XmlException: The body of the message cannot be read because it is empty. --- End of inner exception stack trace --- </ExceptionString> <InnerException> <ExceptionType>System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> <Message>The body of the message cannot be read because it is empty.</Message> <StackTrace> at System.ServiceModel.Channels.HttpRequestContext.CreateMessage() at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback) at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state) at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) </StackTrace> <ExceptionString>System.Xml.XmlException: The body of the message cannot be read because it is empty.</ExceptionString> </InnerException> </Exception> </TraceRecord> </DataItem> </TraceData> So, here is my service interface: [ServiceContract] public interface IRDCService { [OperationContract] Response<Customer> GetCustomer(CustomerRequest request); [OperationContract] Response<Customer> GetSiteCustomers(CustomerRequest request); } And here is my service instance public class RDCService : IRDCService { ICustomerService customerService; public RDCService() { //We have to locate the instance from structuremap manually because web services *REQUIRE* a default constructor customerService = ServiceLocator.Locate<ICustomerService>(); } public Response<Customer> GetCustomer(CustomerRequest request) { return customerService.GetCustomer(request); } public Response<Customer> GetSiteCustomers(CustomerRequest request) { return customerService.GetSiteCustomers(request); } } The configuration for the web service (server side) looks like this: <system.serviceModel> <diagnostics> <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" /> </diagnostics> <services> <service behaviorConfiguration="MySite.Web.Services.RDCServiceBehavior" name="MySite.Web.Services.RDCService"> <endpoint address="http://localhost:27433" binding="wsHttpBinding" contract="MySite.Common.Services.Web.IRDCService"> <identity> <dns value="localhost:27433" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MySite.Web.Services.RDCServiceBehavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="true"/> <dataContractSerializer maxItemsInObjectGraph="6553600" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> Here is what my request object looks like [DataContract] public class CustomerRequest : RequestBase { [DataMember] public int Id { get; set; } [DataMember] public int SiteId { get; set; } } And the RequestBase: [DataContract] public abstract class RequestBase : IRequest { #region IRequest Members [DataMember] public int PageSize { get; set; } [DataMember] public int PageIndex { get; set; } #endregion } And my IRequest interface public interface IRequest { int PageSize { get; set; } int PageIndex { get; set; } } And I have a wrapper class around my service calls. Here is the class. public class MyService : IMyService { IRDCService service; public MyService() { //service = new MySite.RDCService.RDCServiceClient(); EndpointAddress address = new EndpointAddress(APISettings.Default.ServiceUrl); BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None); binding.TransferMode = TransferMode.Streamed; binding.MaxBufferSize = 65536; binding.MaxReceivedMessageSize = 4194304; ChannelFactory<IRDCService> factory = new ChannelFactory<IRDCService>(binding, address); service = factory.CreateChannel(); } public Response<Customer> GetCustomer(CustomerRequest request) { return service.GetCustomer(request); } public Response<Customer> GetSiteCustomers(CustomerRequest request) { return service.GetSiteCustomers(request); } } and finally, the response object. [DataContract] public class Response<T> { [DataMember] public IEnumerable<T> Results { get; set; } [DataMember] public int TotalResults { get; set; } [DataMember] public int PageIndex { get; set; } [DataMember] public int PageSize { get; set; } [DataMember] public RulesException Exception { get; set; } } So, when I build my CustomerRequest object and pass it in, for some reason it's hitting the server as an empty request. Any ideas why? I've tried upping the object graph and the message size. When I debug it stops in the wrapper class with the 400 error. I'm not sure if there is a serialization error, but considering the object contract is 4 integer properties I can't imagine it causing an issue.

    Read the article

  • ContractFilter mismatch at the EndpointDispatcher

    - by Matt
    I've created a simple WCF service but when I use Visual Studio to add a service reference, this error comes up. The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None). Here is my Interface [ServiceContract] public interface IService { [OperationContract] DateTime GetTime(); } And my implementation [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class TestService : IService { public DateTime GetTime() { return DateTime.Now; } } Finally here is my web.config <system.serviceModel> <client/> <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> <services> <service name="Test.TestService" > <endpoint address="" contract="Test.IService" binding="basicHttpBinding" > </endpoint> </service> </services> </system.serviceModel>

    Read the article

  • Autofac WCF integration + sessions

    - by Michael Sagalovich
    I am having an ASP.NET MVC 3 application that collaborates with a WCF service, which is hosted using Autofac host factory. Here are some code samples: .svc file: <%@ ServiceHost Language="C#" Debug="true" Service="MyNamespace.IMyContract, MyAssembly" Factory="Autofac.Integration.Wcf.AutofacServiceHostFactory, Autofac.Integration.Wcf" %> Global.asax of the WCF service project: protected void Application_Start(object sender, EventArgs e) { ContainerBuilder builder = new ContainerBuilder(); //Here I perform all registrations, including implementation of IMyContract AutofacServiceHostFactory.Container = builder.Build(); } Client proxy class constructor (MVC side): ContainerBuilder builder = new ContainerBuilder(); builder.Register(c => new ChannelFactory<IMyContract>( new BasicHttpBinding(), new EndpointAddress(Settings.Default.Url_MyService))) .SingleInstance(); builder.Register(c => c.Resolve<ChannelFactory<IMyContract>>().CreateChannel()) .UseWcfSafeRelease(); _container = builder.Build(); This works fine until I want WCF service to allow or require sessions ([ServiceContract(SessionMode = SessionMode.Allowed)], or [ServiceContract(SessionMode = SessionMode.Required)]) and to share one session with the MVC side. I changed the binding to WSHttpBinding on the MVC side, but I am having different exceptions depending on how I tune it. I also tried changing AutofacServiceHostFactory to AutofacWebServiceHostFactory, with no result. I am not using config file as I am mainly experimenting, not developing real-life application, but I need to study the case. But if you think I can achieve what I need only with config files, then OK, I'll use them. I will provide exception details for each combination of settings if required, I'm omitting them not to make the post too large. Any ideas on what I can do?

    Read the article

  • WCF Web Service Gives 404 error in Azure

    - by landyman
    I'm new to using WCF and Azure, but I have a WCF Web Service that works correctly when debugging in Visual Studio. I set the startup project to Azure, and I get 404 errors for any URL I try related to the service. Here is what I think is relavant code: From IWebService.cs [OperationContract] [WebGet(UriTemplate = "GetData/Xml?value={value}", ResponseFormat=WebMessageFormat.Xml)] string GetDataXml(string value); and from Web.config: <system.serviceModel> <services> <service name="WebService" behaviorConfiguration="WebServiceBehavior"> <!-- Service Endpoints --> <endpoint address="" binding="webHttpBinding" contract="IWebService" behaviorConfiguration="WebEndpointBehavior"></endpoint> <endpoint address="ws" binding="wsHttpBinding" contract="IWebService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="WebServiceBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="WebEndpointBehavior"> <webHttp/> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel> I have tried changing the binding to 'basicHttpBinding', but that had no luck. Thanks in advance for any help!

    Read the article

  • Multiple Base Addresses and Multiple Endpoints in WCF

    - by mnhab
    I'm using two bindings TCP and HTTP. I want to give mex data on both bindings. What I want is that the mexHttpBinding only exposes the HTTP services while the mexTcpBinding exposes TCP services only. Or is this possible that I access stats service only from HTTP binding and the eventLogging service from TCP? For Example: For TCP I should only have net.tcp://localhost:9001/ABC/mex net.tcp://localhost:9001/ABC/eventLogging For HTTP http://localhost:9002/ABC/stats http://localhost:9002/ABC/mex When I connect with any of the base address (using the WCF Test Client) I'm able to access all the services? Like when I connect with net.tcp://localhost:9001/ABC I'm able to use the services which are offered on the HTTP binding. Why is that so? <system.serviceModel> <services> <service behaviorConfiguration="ABCServiceBehavior" name="ABC.Data.DataServiceWCF"> <endpoint address="eventLogging" binding="netTcpBinding" contract="ABC.Campaign.IEventLoggingService" /> <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" /> <endpoint address="stats" binding="basicHttpBinding" contract="ABC.Data.IStatsService" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="net.tcp://localhost:9001/ABC" /> <add baseAddress="http://localhost:9002/ABC" /> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="ABCServiceBehavior"> <serviceMetadata httpGetEnabled="false" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>

    Read the article

< Previous Page | 2 3 4 5 6 7 8  | Next Page >