У меня есть 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.
Как я могу решить эту проблему?
У вас есть файл WSDL? – Coder1409
@ Coder1409 да у меня есть. Похоже, я должен использовать wsdl вместо svc. я прав? – Happy
Попробуйте скопировать WSDL, вставьте его в файл .WSDL, добавьте ссылку на этот файл в этот файл и повторите попытку, если проблема не будет устранена, если у вас есть определение контракта вашей службы. – Coder1409