简体   繁体   English

IIS7服务器上的Web服务用于Apache服务器上的网站

[英]Web Services on IIS7 Server for Website on Apache Server

We have several servers here. 我们这里有几台服务器。

Most of our Web Servers are Windows 2008 R2 machines running Apache and MySQL, but we also have IIS7 Web Servers that run SQL Server 2008 databases. 我们的大多数Web服务器都是运行Apache和MySQL的Windows 2008 R2计算机,但是我们也有运行SQL Server 2008数据库的IIS7 Web服务器

The data I to use in my web reports is partially on the IIS7 Web Servers 's SQL database and partially on the Apache Web Server 's MySQL database. 我在Web报表中使用的数据部分位于IIS7 Web服务器的SQL数据库上,部分位于Apache Web服务器的MySQL数据库上。

A little over a year ago, I was introduced to Web Services in IIS7 when work upgraded from Windows 2000 servers. 一年多以前,当我从Windows 2000服务器升级工作时,就向我介绍了IIS7中的Web服务。

I liked creating the Web Service, and I would like to think that this is the way to go. 我喜欢创建Web服务,并且我想这是要走的路。 All of the examples I have seen for Visual Studio 2010 (what we have here) only show how to do this with a .Net 3.5 project. 我在Visual Studio 2010中看到的所有示例(我们在这里拥有的内容)仅显示了如何使用.Net 3.5项目执行此操作。 If there is something for .Net 4.0, it must be called something other than Web Services . 如果.Net 4.0包含某些内容,则必须将其称为Web Services以外的名称

I want to write an application that reads the data from the MySQL database on the Apache Web Server and combines that with the data from the SQL database on the IIS7 Web Servers . 我想编写一个应用程序,该应用程序从Apache Web服务器上的MySQL数据库读取数据,并将其与IIS7 Web服务器上的SQL数据库数据相结合。

Then, I need to be able to read that data from a website written in PHP on the Apache Web Server . 然后,我需要能够从Apache Web Server上用PHP编写的网站中读取数据。

So, what am I asking? 那么,我在问什么呢? How to proceed, I suppose. 我想如何进行。

  • What kind of project should I create in Visual Studio 2010? 我应该在Visual Studio 2010中创建哪种项目? Reading 1 datatable from each database is easy, but I need to know how to best make that data accessible. 从每个数据库读取1个数据表很容易,但是我需要知道如何最好地使该数据可访问。
  • How should I access this data through PHP? 我应该如何通过PHP访问这些数据?

Are there roadblocks that I am going to encounter that will prevent this? 我是否会遇到阻碍这一切的障碍?

Is there any particular type of services I should be looking into? 我应该研究什么类型的服务? I'm not sure if I can use a web service with PHP code. 我不确定是否可以将Web服务与PHP代码一起使用。

The web.config file has to be configured correctly for PHP's basic SOAP class to read from Microsoft's WCF. 必须正确配置web.config文件, PHP的基本SOAP类才能从Microsoft的WCF中读取。 In fact, it seems to need binding="basicHttpBinding" . 实际上,似乎需要binding="basicHttpBinding"

Here is what I have: 这是我所拥有的:

<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>

One important element I was missing in my WCF project, though, was WebGet - because I simply was not able to install the reference to my project. 但是,我在WCF项目中缺少的一个重要元素是WebGet-因为我根本无法安装对项目的引用。

What I found on MSDN's Blog Getting Started with WCF WebHttp Services in .NET 4 is that a VS2010 project has to use the Full .NET 4 Framework , not the Client Profile like I was using. 我在MSDN的.NET 4中的WCF WebHttp服务入门博客中发现,VS2010项目必须使用完整的.NET 4框架 ,而不是像我以前使用的客户端配置文件。

Once I did that, and restarted the project, I was able to add System.ServiceModel.Web from the list of References. 完成该操作并重新启动项目后,便可以从“引用”列表中添加System.ServiceModel.Web

The Web.config section about the <standardEndpoints> section was from Step 8 in CodeProject:Create and Consume RESTFul Service in .NET Framework 4.0 . 关于<standardEndpoints>部分的Web.config部分来自CodeProject中的步骤8 :.NET Framework 4.0中的Create and Consume RESTFul Service

This answer is a work in progress. 这个答案是一个正在进行的工作。 I will add to it as I learn more. 当我了解更多信息时,我将对其进行添加。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM