我有一個甜蜜的WinForm應用程序(在我的電腦上)和一個SQL Server數據庫(在服務器X上)。我使用的是SqlConnection
,一切正常。SQL Server數據庫,wcf和WinForm
但不是我想改變它,並使用WCF或其他技術來連接和切換我的應用程序和數據庫之間的信息。
我還有一臺服務器用作應用程序服務器(服務器Y)。
我已經開始使用WCF:創建的項目,創建安裝程序。
將它上傳到我的Y服務器並安裝它。服務開始了,我也添加了服務引用到我的WinForm應用程序,但ServiceClient
工作不正常。
當我打電話ServiceClient
的方法它拋出異常:
類型的異常‘System.ServiceModel.EndpointNotFoundException’出現在mscorlib.dll但在用戶代碼中沒有處理
附加信息:在http://localhost:41272/service沒有可以接受消息的端點。這通常是由不正確的地址或SOAP操作引起的。有關更多詳細信息,請參閱InnerException(如果存在)。
正如我想我的終端正在吹捧的東西。
所以我想你們幫我配置SQL端點。
這裏是我的WCF的web.config
:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime />
<pages controlRenderingCompatibilityVersion="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="SampleSvcBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="SampleSvcBehavior"
name="FMG_WCF.FmgService">
<endpoint name="SampleSvcBasicHttpEndPoint"
address=""
binding="basicHttpBinding" bindingConfiguration=""
contract="FMG_WCF.IFmgService" />
<endpoint name="SampleSvcMexHttpEndPoint"
address="mex"
binding="mexHttpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:41272/service" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
'localhost:41272'不是遠程機器。 –
感謝您的回覆,Preston Guillot。 確定它不是。我的問題是如何爲我的服務器配置端點X –
我相信你不需要數據庫服務器的端點。你只需要一個連接字符串從你的WCF服務連接數據庫。 – Dileep