简体   繁体   中英

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.

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.

A little over a year ago, I was introduced to Web Services in IIS7 when work upgraded from Windows 2000 servers.

I liked creating the Web Service, and I would like to think that this is the way to go. 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. If there is something for .Net 4.0, it must be called something other than 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 .

Then, I need to be able to read that data from a website written in PHP on the Apache Web Server .

So, what am I asking? How to proceed, I suppose.

  • What kind of project should I create in Visual Studio 2010? Reading 1 datatable from each database is easy, but I need to know how to best make that data accessible.
  • How should I access this data through 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.

The web.config file has to be configured correctly for PHP's basic SOAP class to read from Microsoft's WCF. In fact, it seems to need 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.

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.

Once I did that, and restarted the project, I was able to add System.ServiceModel.Web from the list of References.

The Web.config section about the <standardEndpoints> section was from Step 8 in CodeProject:Create and Consume RESTFul Service in .NET Framework 4.0 .

This answer is a work in progress. I will add to it as I learn more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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