Der content-type application/xml;charset=utf-8 der Antwort-Nachricht nicht mit dem Inhaltstyp der Bindung (text/xml; charset=utf-8), WCF

Ich weiß, diese Frage wurde gebeten, ein paar mal vor, aber die Lösungen, die entweder keine Arbeit für mich oder ich bin zu unwissend, um zu verstehen, wie man die Lösung implementieren.

So, die website, die ich bin versucht zu laufen, läuft der WCF-client. Wenn ein WCF-Dienst versucht, aufgerufen werden (dh, jede Datenbank zu suchen oder Bearbeiten), kommt es mit diesem Fehler

Dem content-type text/html; charset=utf-8 der Antwort-Nachricht enthält
nicht mit dem Inhaltstyp der Bindung (text/xml; charset=utf-8).
Wenn Sie einen benutzerdefinierten encoder verwenden, sicher sein, dass die IsContentTypeSupported
Methode richtig umgesetzt wird. Die ersten 1024 bytes der Antwort
waren: '

Wenn ich diese Fehler entstehen durch eine nicht behandelte Ausnahme, das ist das, was erscheint,

http://i.imgur.com/Vj7Baik.png

(Hinweis: die Zeile, schneidet am Ende liest)

[ProtocolException: 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). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<!DOCTYPE html>

Hier ist das web.config-Datei für die Website verwendet wird (ich bin mir nicht sicher, ob das problem hier konzentrieren, aber ich habe eine nagende Verdacht ist)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=localhost;Initial Catalog=DefaultConnection;Integrated Security=false;User ID=******;Password=******;"/>
    <add name="ITPDatabase" connectionString="Data Source=localhost;Initial Catalog=ITPDatabase;Integrated Security=false;User ID=******;Password=******;"/>
  </connectionStrings>
  <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Optimization" />
      </namespaces>
    <controls>
      <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
    </controls></pages>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" defaultUrl="~/" timeout="2880" />
    </authentication>
    <profile defaultProvider="DefaultProfileProvider">
      <providers>
        <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
      </providers>
    </profile>
    <membership defaultProvider="DefaultMembershipProvider">
      <providers>
        <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
      </providers>
    </membership>
    <roleManager enabled="true" defaultProvider="DefaultRoleProvider">
      <providers>
        <add connectionStringName="DefaultConnection" applicationName="/"
          name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </providers>
    </roleManager>
    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
      </providers>
    </sessionState>
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IService1" />
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="defaultServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="defaultEndpointBehaviour">
        <webHttp/>
      </behavior>
    </endpointBehaviors>
    </behaviors>
    <services>
    <service name="*****.Service1" behaviorConfiguration="defaultServiceBehaviour">
      <endpoint address="" binding="wsHttpBinding" contract="ServiceReference1.IService1"></endpoint>
    <endpoint address="http://<domainname>.com/Service1.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
        contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>

    </service>

    </services>

    <client>
    <endpoint address="http://<domainname>.com/Service1.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
        contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
    </client>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
      multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
        <handlers accessPolicy="Read, Execute, Script">
            <add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" resourceType="File" preCondition="integratedMode" />  </handlers>

    </system.webServer>


</configuration>

Nun, aus dem, was ich mitbekommen habe von anderen Fragen, die Kernaussage der Fehler ich erhalte, ist, anstatt die xml-Antwort von der Datenbank, ich bekomme eine html-Seite Fehler.

Bevor Sie Fragen, habe ich hier schon Hilfe erhalten Sie von der web-host-tech-support, aber an dieser Stelle Sie sind sich nicht sicher, was das problem ist (oder zumindest die person, die ich Sprach, war nicht sicher)
Wir verwendet, IIS, um zu versuchen zu basteln, die mit bestimmten Einstellungen im system (keine wirkliche Veränderung), so kann ich davon ausgehen, daß die Website gehostet wird unter IIS?

Jede Hilfe in der Sache ist sehr appeciated.

InformationsquelleAutor SASFalcon | 2015-01-05
Schreibe einen Kommentar