[英]WCF bindings mismatch
I am brand new to WCF and I am running into an issue. 我是WCF的新手,我遇到了一个问题。 I have a solution with a WCF service and a Unit Test.
我有一个带有WCF服务和单元测试的解决方案。 I can build the solution but when I go to -> Add Service Reference -> Discover and click on my service I get this exception
我可以构建解决方案,但是当我转到->添加服务参考->发现并单击我的服务时,出现此异常
There was an error downloading
'http://localhost/MyService.svc/_vti_bin/ListData.svc/$metadata'
.下载
'http://localhost/MyService.svc/_vti_bin/ListData.svc/$metadata'
出错。 The request failed with HTTP status 404: Not Found.请求失败,HTTP状态为404:找不到。 Metadata contains a reference that cannot be resolved:
'http://localhost/MyService.svc'
.元数据包含无法解析的引用:
'http://localhost/MyService.svc'
。 Content Type application/soap+xml;内容类型application / soap + xml; charset=utf-8 was not supported by service
http://localhost/MyService.svc
.服务
http://localhost/MyService.svc
不支持charset = utf-8。 The client and service bindings may be mismatched.客户端和服务绑定可能不匹配。 The remote server returned an error: (415) Unsupported Media Type.
远程服务器返回错误:(415)不支持的媒体类型。 If the service is defined in the current solution, try building the solution and adding the service reference again.
如果服务是在当前解决方案中定义的,请尝试构建解决方案并再次添加服务引用。
I have read numerous things but nothing is working, any ideas? 我读了很多东西,但是什么都没用,有什么想法吗?
Here is my config 这是我的配置
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="Services.Biceps.BicepsItemService.ServiceBehavior" name="BicepsItemService">
<endpoint address="basic" binding="basicHttpBinding" contract="Services.Biceps.IItemService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Services.Biceps.BicepsItemService.ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
问题是我在配置的“服务”属性中的“ 名称”中列出了错误的类型,我使用了接口而不是“实现”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.