Weird DASP IIS 8/7 servers WCF error, getting desperated

Discussion in 'General troubleshooting' started by aspnetprue1, Nov 9, 2015.

  1. Sorry for my English, I hope I can be understood.

    I'm evaluating DASP because I want to buy about 10 different accounts for different purposes, but I'm having a weird error that I think it's from the DASP IIS servers:


    1) Account 1, W2012/IIS 8, host the most simple WCF service, a function that only accept a string, does absolutely NOTHING:

    *****Interface:*****
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    //using System.Threading.Tasks;
    using System.ServiceModel;
    namespace HelloWorldService
    {
    [ServiceContract]
    interface IHelloWorldService
    {
    [OperationContract]
    string GetMessage(string name);
    }
    }

    *****Service:*****
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    //using System.Threading.Tasks;
    using System.ServiceModel;
    namespace HelloWorldService
    {
    public class HelloWorldService: IHelloWorldService
    {
    public string GetMessage(string name)
    {
    return "Hello world from " + name + "!";
    }
    }
    }
     
  2. *****In client:*****

    var client = new ServiceReference1.HelloWorldServiceClient();
     
  3. having problems posting
     
  4. *****in client*****
    var client = new ServiceReference1.HelloWorldServiceClient();
    string s = "convert(datetime,";
    Console.WriteLine(client.GetMessage(s));
     
    Last edited: Nov 9, 2015
  5. *****Web.config (SERVICE)*****
    <?xml version="1.0"?>
    <!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=169433
    -->
    <configuration>
    <!--
    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
    <system.Web>
    <httpRuntime targetFramework="4.5.2" />
    </system.Web>
    -->

    <system.diagnostics>
    <trace autoflush="true" />
    <sources>
    <source name="System.ServiceModel.MessageLogging" switchValue="All, ActivityTracing">
    <listeners>
    <add name="General" />
    </listeners>
    </source>
    <source name="System.ServiceModel" switchValue="All, ActivityTracing">
    <listeners>
    <add name="General" />
    </listeners>
    </source>
    <source name="System.Runtime.Serialization" switchValue="All, ActivityTracing">
    <listeners>
    <add name="General" />
    </listeners>
    </source>
    <source name="System.IO.Log" switchValue="All, ActivityTracing">
    <listeners>
    <add name="General" />
    </listeners>
    </source>
    <source name="System.Net">
    <listeners>
    <add name="General"/>
    </listeners>
    </source>
    <source name="System.Net.Cache">
    <listeners>
    <add name="General"/>
    </listeners>
    </source>
    <source name="System.Net.Http">
    <listeners>
    <add name="General"/>
    </listeners>
    </source>
    <source name="System.Net.Sockets">
    <listeners>
    <add name="General"/>
    </listeners>
    </source>
    <source name="System.Net.WebSockets">
    <listeners>
    <add name="General"/>
    </listeners>
    </source>
    </sources>
    <switches>
    <add name="System.Net" value="Verbose"/>
    <add name="System.Net.Cache" value="Verbose"/>
    <add name="System.Net.Http" value="Verbose"/>
    <add name="System.Net.Sockets" value="Verbose"/>
    <add name="System.Net.WebSockets" value="Verbose"/>
    </switches>
    <sharedListeners>
    <add name="General" initializeData="service_tracelog.svclog"
    type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" traceOutputOptions="Timestamp" />
    </sharedListeners>
    </system.diagnostics>

    <system.web>
    <compilation debug="true" targetFramework="4.5.2"/>
    <httpRuntime/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
    </system.web>
    <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
    <serviceActivations>
    <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="./HelloWorldService.svc" service="HelloWorldService.HelloWorldService"/>
    </serviceActivations>
    </serviceHostingEnvironment>
    <behaviors>
    <serviceBehaviors>
    <behavior>
    <serviceMetadata httpGetEnabled="true"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>
    </system.serviceModel>
    </configuration>
     
  6. *****App.config (CLIENT)*****
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>

    <system.diagnostics>
    <trace autoflush="true" />
    <sources>
    <source name="System.ServiceModel.MessageLogging" switchValue="All, ActivityTracing">
    <listeners>
    <add name="General" />
    </listeners>
    </source>
    <source name="System.ServiceModel" switchValue="All, ActivityTracing">
    <listeners>
    <add name="General" />
    </listeners>
    </source>
    <source name="System.Runtime.Serialization" switchValue="All, ActivityTracing">
    <listeners>
    <add name="General" />
    </listeners>
    </source>
    <source name="System.IO.Log" switchValue="All, ActivityTracing">
    <listeners>
    <add name="General" />
    </listeners>
    </source>
    <source name="System.Net">
    <listeners>
    <add name="General"/>
    </listeners>
    </source>
    <source name="System.Net.Cache">
    <listeners>
    <add name="General"/>
    </listeners>
    </source>
    <source name="System.Net.Http">
    <listeners>
    <add name="General"/>
    </listeners>
    </source>
    <source name="System.Net.Sockets">
    <listeners>
    <add name="General"/>
    </listeners>
    </source>
    <source name="System.Net.WebSockets">
    <listeners>
    <add name="General"/>
    </listeners>
    </source>
    </sources>
    <switches>
    <add name="System.Net" value="Verbose"/>
    <add name="System.Net.Cache" value="Verbose"/>
    <add name="System.Net.Http" value="Verbose"/>
    <add name="System.Net.Sockets" value="Verbose"/>
    <add name="System.Net.WebSockets" value="Verbose"/>
    </switches>
    <sharedListeners>
    <add name="General" initializeData="C:\client_tracelog.svclog"
    type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" traceOutputOptions="Timestamp" />
    </sharedListeners>
    </system.diagnostics>

    <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
    <system.serviceModel>
    <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding_IHelloWorldService" />
    </basicHttpBinding>
    </bindings>
    <client>
    <endpoint address="http://aspnetprueba3.com/NXDALWS/HelloWorldService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IHelloWorldService"
    contract="ServiceReference1.IHelloWorldService" name="BasicHttpBinding_IHelloWorldService" />
    </client>
    </system.serviceModel>
    </configuration>
     
  7. 2) Run client, ERROR:

    Unhandled Exception: System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to http://aspnetprueba3.com/NXDALWS/HelloWorldService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed:
    An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    --- End of inner exception stack trace ---
    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
    --- End of inner exception stack trace ---
    at System.Net.HttpWebRequest.GetResponse()
    at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    --- End of inner exception stack trace ---

    Server stack trace:
    at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
    at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
    at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at HelloWorldClient.ServiceReference1.IHelloWorldService.GetMessage(String name)
    at HelloWorldClient.ServiceReference1.HelloWorldServiceClient.GetMessage(String name) in C:\Users\GHR\Desktop\New folder\VS 2015\NXDataAccessLayer35\HelloWorldClient\Service References\ServiceReference1\Reference.cs:line 53
    at HelloWorldClient.Program.Main(String[] args) in C:\Users\GHR\Desktop\New folder\VS 2015\NXDataAccessLayer35\HelloWorldClient\Program.cs:line 120
     
  8. 3) Change the line:
    string s = "convert(datetime;"; // <-Use now ";"

    Results as EXPECTED:

    Hello world from convert(datetime; !
    Press any key to continue . . .

    wtf ? !!! I have tried .NET 3.5 / 4.0 / 4.5 / 4.5.2, 32 / 64 bits, Visual Studio 2008 / 2015, Visual Basic/ C#.
     
  9. *****Client trace:*****

    <E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
    <EventID>0</EventID>
    <Type>3</Type>
    <SubType Name="Error">0</SubType>
    <Level>2</Level>
    <TimeCreated SystemTime="2015-11-10T00:48:54.9107286Z" />
    <Source Name="System.Net.Sockets" />
    <Correlation ActivityID="{40d73a88-7f8e-4ae9-aeea-aed41daaeb49}" />
    <Execution ProcessName="HelloWorldClient" ProcessID="17536" ThreadID="1" />
    <Channel />
    <Computer>GHR-PC</Computer>
    </System>
    <ApplicationData>[18184] Socket#14993092::UpdateStatusAfterSocketError() - ConnectionAborted</ApplicationData>
    </E2ETraceEvent>

    (Complete trace is uploaded)
     
  10. *****Server trace (a warning):*****

    <E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
    <EventID>524312</EventID>
    <Type>3</Type>
    <SubType Name="Warning">0</SubType>
    <Level>4</Level>
    <TimeCreated SystemTime="2015-11-10T00:49:37.7679601Z" />
    <Source Name="System.ServiceModel" />
    <Correlation ActivityID="{2a9c0d98-abe7-423d-91d0-f349dbc2786e}" />
    <Execution ProcessName="w3wp" ProcessID="176172" ThreadID="133" />
    <Channel />
    <Computer>WEB711</Computer>
    </System>
    <ApplicationData>
    <TraceData>
    <DataItem>
    <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Warning">
    <TraceIdentifier>http://msdn.microsoft.com/en-US/lib...luationContextNotFound.aspx</TraceIdentifier>
    <Description>Configuration evaluation context not found.</Description>
    <AppDomain>/LM/W3SVC/979980/ROOT/NXDALWS-6-130915901775963513</AppDomain>
    </TraceRecord>
    </DataItem>
    </TraceData>
    </ApplicationData>
    </E2ETraceEvent>

    (Complete trace is uploaded)
     
  11. *****Failed Request Tracing:*****

    157. -AspNetPipelineEnter
    ConnID 0
    Context ID {00000000-0000-0000-ED58-058001000030}
    Data1 System.ServiceModel.Activation.ServiceHttpModule

    158. -GENERAL_READ_ENTITY_START

    159. -GENERAL_READ_ENTITY_END
    BytesReceived 0
    ErrorCode 2147943395
    ErrorCode The I/O operation has been aborted because of either a thread exit or an application request. (0x800703e3)

    160. -NOTIFY_MODULE_COMPLETION
    ModuleName ServiceModel-4.0
    Notification 2
    fIsPostNotificationEvent true
    CompletionBytes 0
    ErrorCode 2147943395
    Notification AUTHENTICATE_REQUEST
    ErrorCode The I/O operation has been aborted because of either a thread exit or an application request. (0x800703e3)

    (Complete trace is uploaded)


    Fiddler request/response also uploaded.


    It seems like the IIS reject the request, the wcf service is not reached at all.
     
  12. 4) Account 2, W2008/IIS 7, host the same wcf service (heck, I even paid an EXTRA account for testing):
    SAME RESULTS.

    This error happens also when trying to send strings of distinct length, sometimes it succeeds sending the strings.

    5) Tested in another server (NOT DASP), W2008/IIS 7, to host the same wcf service (uploaded same string, and testing with strings from only 10 bytes to 16 MB):
    IT WORKS.

    I'm getting desperate as I already wasted about a week on this issue, please tell me if there is some weird configuration or compiler or something that needs to be taken in account to use DASP or if there is a problem with DASP IIS servers, any help will be GREATLY appreciated, regards.

    (The traces files/fiddler image are in the attached file)
     
  13. martino

    martino DiscountASP.NET Staff

    mjp likes this.
  14. Thanks for your response Martino, sorry, the IIS on http://aspnetprueba2.com was stopped, but it's started again, and the error persists, could you try again?

    In Fiddler the response it's 500, as I can see the request doesn't even get to the service.

    It's weird because I have sent to this very service even strings of several MB, but there are cases when the IIS gives 500 internal error, and in this case in particular, a simple 17 character string (above example) simply refuse to accept, unless I change a character, and in this case it WORKS.

    I guess there is some problem with the IIS server, the server communication side or something, as I stated I hosted this very service in other machine with W2008/IIS 7 with this test case and all is OK.

    I even recompiled the service and the client from my machine (Windows 7 Ultimate 64 bit) to another machine (Windows 10) and even tested with another internet connection, and no dice, so I can only assume that there is something really wrong on the DASP IIS server.

    Please let me know if you can help me, as my clients are getting impatient and I need to decide if I continue with DASP, or even search for some alternative, thanks for your attention.
     
  15. Also I want to say that it has been very difficult for me to post in this forum, for some reason I need to edit my messages several times before they can be accepted, it's like they detect some problem in the text but there is no error message, the posts are size limited or can't process some characters or something? thanks
     
  16. martino

    martino DiscountASP.NET Staff

    Can you give us exact instructions on how to recreate the 500 error? Or provide us with a screen shot of the full 500 error message.

    When I visited your site I got our welcome page and your service that you uploaded I didn't get any 500 error messages.

    Also, when I did a POST request to your service I didn't get a 500 error message.

    It's most likely a difference in settings. No two web servers are like especially if one of them doesn't belong to us.
     
  17. martino

    martino DiscountASP.NET Staff

    Looking at your issue again I did a "PUT" Request against your service URL and I got a different error message.

    405 Method Not Allowed


    It appears as if the WEBDAV Module is in the way. You have the ability to remove it.

    Connect to your site via IIS Manager.

    Once connected. Double click on Modules icon.

    Look for WebDAVModule and select it.

    Then remove it by click on the Remove option under the Actions panel on the right hand corner.
     
    mjp likes this.
  18. martino

    martino DiscountASP.NET Staff

    Now I'm getting a different error again.

    415 Cannot process the message because the content type 'application/octet-stream' was not the expected type 'text/xml; charset=utf-8'.

    I get that error when I do a POST request

    Looking around I found this web page article here: http://stackoverflow.com/questions/...ssage-because-the-content-type-application-js and this article here: http://stackoverflow.com/questions/...e-the-content-type-application-json-charset-u

    It has something to do with your Endpoint.

    From those web page articles:

     
    mjp likes this.
  19. Sure, I uploaded the traces and the fiddler image in the post # 12, I will post the image from Fiddler (this is from the aspnetprueba3.com site, but it's the same problem on aspnetprueba2.com site):


    upload_2015-11-10_17-49-19.png

    When you access via browser there is no problem, the problem happens when accessing the service via code.
     
  20. In Control Panel WebDAV is disabled.

    In IIS Manager the module was removed, restarted and recycled IIS, but the problem persists.
     
  21. Interesting, because according to my knowledge I'm configuring the service's endpoint correctly, but with microsoft and their great technologies one never know, I will take a look and test immediately those suggestions, any additional insight from you knowledge and experience I will be greatly grateful, thanks Martino.
     
  22. Martino, as per your last post I tried those suggestions, but the error persists!

    I constructed VERY carefully the .config files and the endpoints, but it's the same:

    1) basicHttpBinding (SOAP): SAME ERROR
    2) wsHttpBinding (SOAP): SAME ERROR
    3) webHttpBinding (RESTful): NO ERROR

    The suggested articles talk about the errors in the endpoints BUT in the case of WCF RESTful, I did the test on RESTful for the sake of completeness, and for some reason it did work, but my application uses plain vanilla SOAP, NOT RESTful, and I can't change it.

    Please take a look to the little test program I uploaded (.NET 4.5.2), it reproduces consistently the error, maybe it could give you more information about this issue, frankly I'm quite frustrated, thanks.

    (The program connects to the aspnetprueba2.com site)
     
  23. martino

    martino DiscountASP.NET Staff

    This is the error I'm getting when I run the "Error Case" in your program.

    HTTP/1.1 504 Fiddler - Receive Failure
    Date: Wed, 11 Nov 2015 17:45:12 GMT
    Content-Type: text/html; charset=UTF-8
    Connection: close
    Cache-Control: no-cache, must-revalidate
    Timestamp: 09:45:12.669

    [Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.

    I used Fiddler to get the error message. Also, I see the error message your program is bring up.

    The "No Error Case" points to a different web server that doesn't belong to us?

    Also, Can you please open a support ticket? On the support ticket provide the link to this forum post and provide us with the IP number you're using on your computer. I would need to have our system administrators check our backend for you.
     
    mjp likes this.
  24. NO, in both cases is requesting the *SAME* DASP server: aspnetprueba2.com, that's why I think there is something REALLY weird happening with your servers, and as I stated, it's happening in BOTH of my W2012/IIS 8 AND W2008/IIS 7 accounts.

    I will take a look to the support ticket, I will take some last chances to solve this issue.
     
  25. Ready, support ticket issued, please keep me informed, thanks.
     
  26. martino

    martino DiscountASP.NET Staff

    I got your ticket and I will reply back to you as soon as possible.
     
    RayH and mjp like this.
  27. The support team had a look to the problem and basically I was sending to the service sql commands in plain text for debugging purposes, which were interpreted by the server as a sql injection attack, and therefore were rejected with no meaningful error message (and without this information I was greatly confused).

    So now I sent the strings encrypted and now everything seems ok, I hope this can help someone in the future. Thank you guys for the great support, everything is cool again :D
     
    martino and mjp like this.
  28. mjp

    mjp

    Thanks for following up with the solution, you're right, it will help someone in the future.
     

Share This Page