ProtocolException

Hi i'm getting an exception running a simple ping service that i have
developed that i cannot understand. It's strange because it was running 2
days ago then i have changed some things in iis and it stopped running.
What it's worst is that everything stopped running, even the samples and they
all fail with this exception.

I'm using Visual Studio .net 2005 Beta 2 and the September CTP of Indigo,
and the exception is :

System.ServiceModel.ProtocolException was unhandled
Message="The content type text/html; charset=utf-8 of the response
message does not match the content type of the binding (text/xml;
charset=utf-8)."
Source="mscorlib"
StackTrace:

  Server stack trace:
      at
System.ServiceModel.Channels.HttpChannelUtilities.ThrowResponseException(Exception
exception)

      at
System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest
request, HttpWebResponse response, HttpChannelFactory factory,
WebException responseException)

      at
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout)

      at System.ServiceModel.Channels.RequestChannel.Request(Message
message, TimeSpan timeout)

      at System.ServiceModel.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.ServiceChannel.Call(String
action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
Object[] outs)

      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 IPingService.Ping(String msg)

      at PingServiceProxy.Ping(String msg) in E:\My Documents\My
Projects\Test\WCFClient\PingServiceProxy.cs:line 52

      at WCFClient.Program.Main(String[] args) in E:\My Documents\My
Projects\Test\WCFClient\Program.cs:line 14

Tnis exception happens on iis and on the integrated web server of visual
studio (ths cassini web server).

Tnks for any answer on this subject, i've no clue to what is happening and
i'm starting to think on a major re-install of iis, indigo and visual studio
:-(


Answer this question

ProtocolException

  • Michael_DV

    Ok i have discovered the problem, it's really simple indeed when we host a indigo service in iis or in the cassini web server we must omit the address in the client config so in my config file on the client becomes :

    Client App.config :

    < xml version="1.0" encoding="utf-8" >
    <
    configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
       <
    system.serviceModel>
          <
    client>
             <
    endpoint 
                
    address=""
                
    binding="basicHttpBinding"
                
    contract="IPingService"/>
          </
    client>
       </
    system.serviceModel>
    </
    configuration>


  • Andy K

    The changes to iis were nothing extraordinary the only thing that i remenber
    doing was erasing a virtual directory, anyway it's strange because even the
    cassini web server fails with the same exception...

  • Gary Yukish

    i am also having the same problem and when i applied the solution you mentioned it started giving the following error

    System.InvalidOperationException was unhandled by user code
    Message="The Address property on ChannelFactory.Endpoint was null. The ChannelFactory's Endpoint must have a valid Address specified."
    Source="System.ServiceModel"
    StackTrace:
    at System.ServiceModel.ChannelFactory.CreateEndpointAddress(ServiceEndpoint endpoint)
    at System.ServiceModel.ClientBase`1.CreateChannel()
    at System.ServiceModel.ClientBase`1.get_Channel()
    at Qca.Das.MinervaService.LearnerPortTypeClient.Qca.Das.MinervaService.LearnerPortType.learnerByULN(learnerByULNRequest request) in c:\Inetpub\wwwroot\testproj\App_Code\MinervaService.cs:line 2913
    at _Default.LearnerByULN() in c:\Inetpub\wwwroot\testproj\Default.aspx.cs:line 63
    at _Default.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\testproj\Default.aspx.cs:line 33
    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
    at System.Web.UI.Control.OnLoad(EventArgs e)
    at System.Web.UI.Control.LoadRecursive()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    any one has faced the same problem and got the fix



  • saynotoms

    I've found that the inneException carries this message: "The remote server returned an error: (415) Unsupported Media Type."
    What does this means


  • JCampos

    Ok this is getting strange, i've built a virtual machine with windows XP SP2 and all the latest patches installed (except dot net framework 2.0 RTM) and i've installed (by this order) :

    1 - Visual Studio .NET 2005 Beta 2
    2 - Indigo runtime components September  CTP
    3 - Indigo SDK September CTP
    4 - The integration with Visual Studio

    I've copied my simple ping service to the VM and tested it with the cassini web server and the same exception has appeared !!!! This does not make any sense at all ! This must be some kind of nasty bug...
    The most strange is that i've seen this working and from one moment to another it stopped working :-(.

    Server Web.config :

    < xml version="1.0" >
    <
    configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
       <
    system.serviceModel>
          <
    services>
             <
    service type="PingService">
                <
    endpoint
                   
    address=http://localhost:8080/WCFService/service.svc
                   contract
    ="IPingService"
                   
    binding="basicHttpBinding"/>
             </
    service>
          </
    services>
       </
    system.serviceModel>
       <
    system.web>
          <
    compilation debug="true"/>
       </
    system.web>
    </
    configuration>

    Client App.config :

    < xml version="1.0" encoding="utf-8" >
    <
    configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
       <
    system.serviceModel>
          <
    client>
             <
    endpoint 
                
    address=http://localhost:8080/WCFService/ 
                
    binding="basicHttpBinding"
                
    contract="IPingService"/>
          </
    client>
       </
    system.serviceModel>
    </
    configuration>

     

  • ProtocolException