SharePoint BDC 模型和 WCF
这是我的场景..
我在VS2010中创建了一个BDC模型项目,以便在SharePoint2010中部署。我已添加对我们在另一个系统上运行的 WCF 服务的服务引用。我希望我的 ReadList 方法调用其他系统上的 WCF 服务来提取要在列表中显示的数据。
我为 ReadList 方法创建了一个单元测试,以在部署之前验证它是否有效。我收到的错误消息是“在 ServiceModel 客户端配置部分中找不到引用合同“TicketsWCF.ITickets”的默认端点元素。”
当我添加服务引用时,app.config 会添加到项目中,该项目似乎包含运行服务所需的一切。
我的两个问题是
是否有人获得了与 BDC 合作的非共享点外部系统的 WCF 服务
当模型为部署后,app.config 设置是否会正确放置在 sharepoint 系统中?
Here is my scenario..
I have created a BDC model project in VS2010 for deployment in SharePoint2010. I have added a service reference to a WCF service that we have running on another system. I want my ReadList method to call the WCF service on the other system to pull data to be shown in the list.
I have created a unit test for the ReadList method to verify it works before deploying. The error message that I get is "Could not find default endpoint element that references contract 'TicketsWCF.ITickets' in the ServiceModel client configuration section."
When I add the service reference an app.config is added to the project which appears to have everything that I need for the service to run.
My two questions are
Has anyone gotten a WCF service to a non-sharepoint external system working with BDC
When the model is deployed will the app.config settings get appropriately placed within the sharepoint system?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,我还没有找到在这种情况下使用应用程序配置文件的方法。解决这个问题的一种方法是在代码中定义端点,并可能将端点地址保存在场属性包中。请注意,您必须添加对 System.ServiceModel 的引用。
然后,调用 WCF 服务将类似于:
Unfortunately, I haven't found a way to use an app config file in this case. One way around that is to define your endpoint in code, and possibly save the endpoint address in the farm property bag. Note that you will have to add a Reference to System.ServiceModel.
Then, making calls to your WCF service would be something similar to:
我在许多项目中使用了 WCF 和 BDC。我通常做的事情如下所述。
1) 创建一个名为 SPCommon 的单独 SharePoint 解决方案
2) 添加服务引用
3) 创建 MyAppSettings.cs
4) 创建 ConfigurationManager.cs
5) 创建 MyServiceConnection.cs 文件
6) 在外部列表解决方案中,添加对 SPCommon 项目的引用
7) 调用服务方法 ReadMyList() 如下
8) 将 appsetting 添加到 Web.config
9) 确保部署 SPCommon 和外部列表解决方案。
I have used WCF working with BDC in many projects. What I usually do is described below.
1) Create a separate SharePoint solution called SPCommon
2) Add Service Reference
3) Create MyAppSettings.cs
4) Create ConfigurationManager.cs
5) Create a MyServiceConnection.cs file
6) In the external list solution, add reference to SPCommon project
7) Call the service method ReadMyList() as below
8) Add appsetting to Web.config
9) Make sure to deploy both SPCommon and External List solutions.