2015-04-20 7 views
0

У меня есть url для файла svc. Например, https://Myservicelocation/UserService.svc.как потреблять .svc файл

Теперь я попытался создать веб-приложение asp.net в visual studio и добавил этот url, используя «Добавить ссылку на службу». Когда я поставлю этот URL-адрес, а затем нажмите «go», я получу ошибку

The request failed with HTTP status 400: Bad Request. Metadata contains a reference that cannot be resolved: ' https://Myservicelocation/UserService.svc '. Content Type application/soap+xml; charset=utf-8 was not supported by service https://Myservicelocation/UserService.svc . 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.

Как я могу решить эту проблему?

+0

У вас есть файл WSDL? – Coder1409

+0

@ Coder1409 да у меня есть. Похоже, я должен использовать wsdl вместо svc. я прав? – Happy

+0

Попробуйте скопировать WSDL, вставьте его в файл .WSDL, добавьте ссылку на этот файл в этот файл и повторите попытку, если проблема не будет устранена, если у вас есть определение контракта вашей службы. – Coder1409

ответ

0

Google говорит ..

Probably a mismatch in the client/server bindings, where the message version in the service uses SOAP 1.1 (which expects application/soap+xml) and the version in the client uses SOAP 1.2 (which sends text/xml). WSHttpBinding uses SOAP 1.2, BasicHttpBinding uses SOAP 1.1.

Совместят привязки соответственно ...

Смежные вопросы