問題描述
我們開發(fā)了調(diào)用 Web 服務(wù)方法的 SQL CLR 存儲(chǔ)過程.我們使用VS2010來開發(fā)和調(diào)試這個(gè)項(xiàng)目.問題是當(dāng)我們嘗試啟動(dòng)調(diào)用存儲(chǔ)過程的測試腳本時(shí)出現(xiàn)以下異常:
We develop SQL CLR stored procedure which calls methods of a web-service. We use VS2010 to develop and debug this project. The problem is the following exception when we try to start test script which calls our stored procedure:
A .NET Framework error occurred during execution of user-defined routine or aggregate
"WebServiceExample":
System.InvalidOperationException: Could not find default endpoint element that
references contract 'ServiceReference1.ExRatesSoap' in the ServiceModel client
configuration section. This might be because no configuration file was found for your
application, or because no endpoint element matching this contract could be found in
the client element.
System.InvalidOperationException:
...
在使用 wsdl.exe 和 sgen.exe 實(shí)用程序以及其他操作的網(wǎng)絡(luò)中,有一些關(guān)于此問題的建議.但是我們對(duì)只使用VS2010工具、設(shè)置、選項(xiàng)等的解決方案感興趣.VS2010不能從頭到尾做這個(gè)餡餅似乎令人難以置信,我們認(rèn)為我們做錯(cuò)了什么.
There are some recomendations regarding this problem in the Net which use wsdl.exe and sgen.exe utilities along with another manipulations. But we are interested in solution which utilizes only VS2010 tools, settings, options, etc. It's seemed unbeleivable that VS2010 can't cook this pie from beginning to end, we think we are doing something wrong.
推薦答案
您可能需要在配置文件中手動(dòng)創(chuàng)建對(duì) Web 服務(wù)的引用,例如sqlserver.exe.config 它是從 SQL Server 調(diào)用的.這些不是為 SQL CLR 自動(dòng)創(chuàng)建的,因?yàn)樗?SQL Server 執(zhí)行.
You may have to manually create the reference to the web service in a config file, e.g. sqlserver.exe.config where it is invoked from SQL Server. Those aren't created automatically for SQL CLR since it is executed by SQL Server.
這篇關(guān)于在使用 VS2010 進(jìn)行調(diào)試時(shí),使用 SQL CLR 存儲(chǔ)過程使用 Web 服務(wù)找不到默認(rèn)端點(diǎn)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!