我想学习 WCF,所以我决定尝试创建一些使用它的应用程序。那么我想到的是我有 2 个数据库,我还想创建一个 SSIS 自定义数据源扩展,它调用 Web 服务并将数据(从一个数据库)传递到 SSIS ADO.Net 数据源(进入第二个数据库) .
现在我使用 SQL Server 创建了 2 个数据库,每个数据库都有一个表。然后我在 Visual Studio 中添加了一个连接,然后指定了服务器实例。(没有创建任何 .mdf 文件)。我在 Web.Config 文件中添加了这个 connectionString
<connectionStrings>
<add name="dbconnection" connectionString="
Data Source = SARE-VAIO;
Integrated Security = true;
Initial Catalog = Database1"/>
</connectionStrings>
当我编写基本上用数据填充 Database1 的服务时,我想定义端点,但是当我单击“编辑 WCF 配置”时,它显示“未定义服务”?我在这里做错了什么?我想创建一个无错误服务,以便能够将其用作 SSIS 包中的源。
PS。我的服务有一个 basicHttpsBinding
更新:我将 VS 2012 与 .Net Framework 4.5 一起使用
更新 2:我现在跳过了端点定义,继续测试和部署我的 WCF。当我调用该服务时,它说以下错误
Failed to invoke the service. Possible causes: The service is offline or inaccessible;
the client-side configuration does not match the proxy; the existing proxy is invalid.
Refer to the stack trace for more detail. You can try to recover by starting a new proxy,
restoring to default configuration, or refreshing the service.
这是我的 web.config 文件
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="dbconnection" connectionString="Data Source = SARE-VAIO; Integrated Security = true; Initial Catalog = Database1"/>
</connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="false" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>