我刚刚创建了一个WCF网站.net 3.5,我认为通过创建一个默认的网站就足以复制了。然而复制是很麻烦的。我有从我的MSDN下载的所有更新的VS2013,我有Windows 8.1。
我必须说,几个月前,我在某些机器上遇到了这个问题,所以其他机器已经出现问题而且我认为它与安装有关,但现在它出现在3台不同的机器上,其中一台它们与windows 8.所有这些都是64位。
服务完美无缺,因为直到现在我的可交付成果和生产,它才能顺利进行。
现在我创建了一个基本的ASP.net aqlso .net 3.5。并尝试添加服务引用,它显示以下消息,并且未能添加它。
下载时出错 'http:// localhost:40226 / HabeasDataService.svc / _vti_bin / ListData.svc / $ metadata'。 请求失败,HTTP状态为404:未找到。 元数据包含无法解析的引用:'http:// localhost:40226 / HabeasDataService.svc'。 Ť 远程服务器返回意外响应:(405)方法不允许。 远程服务器返回错误:(405)方法不允许。 如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。
当然,我用clena进行了重建,但问题仍然存在。
服务的配置如下
<system.serviceModel>
<services>
<service behaviorConfiguration="ServicesLayer.Service1Behavior"
name="ServicesLayer.Service1">
<endpoint
bindingConfiguration="BigHttpBinding"
name="BasicHttp"
address=""
binding="basicHttpBinding"
contract="ServicesLayer.IHabeasDataService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServicesLayer.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding
name="BigHttpBinding"
maxBufferSize="65536"
maxBufferPoolSize="65536"
maxReceivedMessageSize="65536"
transferMode="Buffered">
<readerQuotas
maxDepth="64"
maxStringContentLength="65536"
maxArrayLength="65536"
maxBytesPerRead="4096"
maxNameTableCharCount="32768"/>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
我注意到这一行:
<!-- To avoid disclosing metadata information, set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="true"/>
并尝试两种配置,但仍然是同样的错误。
当我通过点击浏览器中的视图尝试运行svc文件时,我得到404.17这样的错误。
这非常令人沮丧,因为它完全阻碍了开发。
注意 与IIS相关的所有内容都可能有用,但请记住它是IIS Express。无论如何切换到本地IIS仍然失败,但正如我所说。在生产服务器上它是薄荷
答案 0 :(得分:0)
根据错误,可能是在WCF之后安装了IIS。
我遇到了类似问题,以下链接帮我解决了问题
http://msdn.microsoft.com/en-gb/library/vstudio/ms752252(v=vs.90).aspx
答案 1 :(得分:0)
我见过这个问题==&gt; ListData.svc是这里的关键==&gt;为集合类使用不正确的数据协定属性时。
不正确的:
[DataContract]
public class MyClassList : List<MyClass>
{
}
正确:
[CollectionDataContract]
public class MyClassList : List<MyClass>
{
}