使用 VS2012 并从 SL 业务应用程序项目开始,我添加了一个 EF 模型 Model1,删除了 tt 文件,将代码生成更改为默认并构建了项目。然后我添加了带有各种表的 DomainService1。未选择 OData。
启动应用程序,它似乎有一个可用的服务:
但是如果我们单击 url,我们希望看到 XML,但它不起作用。附加 ?wsdl 应该会导致 XML 被发送到浏览器,但我只是得到了插图页面。按照本页的建议使用 svcutil 进行尝试会产生以下结果:
Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication
Foundation, Version 4.0.30319.17929] Copyright (c) Microsoft Corporation.
All rights reserved.
Attempting to download metadata from 'http://localhost:57880/Ria1-Web-DomainService1.sv
c?wsdl' using WS-Metadata Exchange or DISCO. Generating files...
Warning: No code was generated. If you were trying to generate a client, this could be
because the metadata documents did not contain any valid contracts or services or
because all contracts/services were discovered to exist in /reference assemblies.
Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure to use
the /dataContractOnly option.
这似乎表明 MEX 端点的设计不正确,所以我的 WCF 书籍出来了,但他们认为应该包含的<system.serviceModel>
内容与实际存在的内容之间没有关联:
<system.serviceModel>
<serviceHostingEnvironment
aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
我需要在配置中添加什么来公开元数据?