我们这里有几台服务器。
我们的大多数Web服务器都是运行Apache和MySQL的Windows 2008 R2计算机,但是我们也有运行SQL Server 2008数据库的IIS7 Web服务器。
我在Web报表中使用的数据部分在IIS7 Web服务器的SQL数据库上,部分在Apache Web服务器的MySQL数据库上。
一年多以前,当我从Windows 2000服务器升级工作时,就向我介绍了IIS7中的Web服务。
我喜欢创建Web服务,并且我想这是要走的路。我在Visual Studio 2010中看到的所有示例(我们在这里拥有的内容)仅显示了如何使用.Net 3.5项目执行此操作。如果.Net 4.0包含某些内容,则必须将其称为Web Services以外的名称。
我想编写一个应用程序,该应用程序从Apache Web服务器上的MySQL数据库读取数据,并将其与IIS7 Web服务器上的SQL数据库数据相结合。
然后,我需要能够从Apache Web Server上用PHP编写的网站中读取数据。
那么,我在问什么呢?我想如何进行。
我是否会遇到阻碍这一切的障碍?
我应该研究什么类型的服务?我不确定是否可以将Web服务与PHP代码一起使用。
必须正确配置web.config文件,PHP的基本SOAP类才能从Microsoft的WCF中读取。实际上,这似乎是必需的binding="basicHttpBinding"
。
这是我所拥有的:
<system.serviceModel>
<services>
<service name="wcfLibrary.Dwgs" behaviorConfiguration="wcfLibrary.DwgsBehavior">
<endpoint address="" binding="basicHttpBinding" contract="wcfLibrary.IDwgs">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Dwg/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="wcfLibrary.DwgsBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"></standardEndpoint>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
但是,我在WCF项目中缺少的一个重要元素是WebGet-因为我根本无法安装对项目的引用。
我在MSDN的.NET 4中的WCF WebHttp服务入门博客中发现,VS2010项目必须使用完整的.NET 4框架,而不是像我以前使用的客户端配置文件。
完成该操作并重新启动项目后,便可以从“引用”列表中添加System.ServiceModel.Web。
该部分的Web.config部分<standardEndpoints>
来自CodeProject中的第8步:.NET Framework 4.0中的Create and Consume RESTFul Service。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句