开发者

Running WCF Service on Vista 64 bit

I have a simple console application which runs as a WCF service host. bsicHttpBinding is used. When I try to get the service reference in my client ( another console app) I get this error

"There was an error downloading http:// localhost:9999/TS. The request failed with HTTP status 400: Bad Request. Metadata contains a reference that cannot be resolved: 'http:// localhost:9999/TS'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:9999/开发者_StackOverflow中文版TS. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.. If the service is defined in the current solution, try building the solution and adding the service reference again."

Please provide any pointers.

App.config:

<configuration>
    <system.serviceModel>
        <services>
            <service
                name="TimeServiceLibrary.TimeService"
                behaviorConfiguration="TSConfig">
                <endpoint address="localhost:9999/TS"
                    binding="basicHttpBinding"
                    contract="TimeServiceLibrary.ITime">
                </endpoint>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="TSConfig">
                    <serviceMetadata httpGetEnabled="True"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
</configuration>


The error seems to suggest that it is attempting to use SOAP 1.2 over a wsHttpBinding instead, but I'm not certain why yet (must be a lack of coffee). It might help if you posted the relevant parts of your config file, or upload it somewhere if it's too large

When you browse to http://localhost:9999/TS/?WSDL, what do you get?

Do you have a mex endpoint (metadata exchange) configured? See here for an example configuration.


Well, the Basic HTTP binding uses SOAP 1.1 under the hood, which in turn uses a content-type of text/xml. The newer WS-HTTP binding uses SOAP 1.2, which uses a application/soap+xml content-type. WCF is complaining because it seems that your service is set up to use a Basic HTTP binding with a application/soap+xml content-type, which isn't going to work.

Maybe you could try adding http:// before localhost in the address, or just use TS for the address, and specify http://localhost:9999 in a Base Address element, e.g. inside the <service> element:

<baseAddress>
   <add baseAddress="http://localhost:9999/" />
</baseAddress>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜