开发者

Cannnot access .svc on a RESTFul WCF Service deployed on local IIS WebServer

I need help, I'm new to the WCF world having recently made the transition from SOAP Webservices.

The WCF service works well when I run in from the VS2008 ASP.NET Development Server i.e. Debug Mode. The problem comes when I try to access the service via IIS.

I've setup a website on my local IIS Webserver hosted on port 8082 (http://localhost:8082) and have created a VirtualDirectory (1.0) that points to the physical directory that contains my WCF Service code. The Website is setup to do ASP.NET 2.0.50727. I can get to the landing page and also an assortment of .aspx pages but when I try to access the Service.svc, the browser never gets there and just sits idling.

http://localhost:8082/1.0/Service.svc  

My question is what setup am I missing to get the service to work from inside IIS since I already know it works under the development server.

I'm attaching part of my web.config if that would help.

    <system.serviceModel>
    <services>
        <service name="Service1" behaviorConfiguration="Service1Behavior">
            <!-- Service Endpoints -->
            <endpoint address="" binding="wsHttpBinding" contract="IService1">
                <开发者_运维知识库;!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.
      -->
                <identity>
                    <dns value="localhost"/>
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="Service1Behavior">
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpGetEnabled="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="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
</system.serviceModel>


You talk about RESTful service, yet you're using the wsHttpBinding.... that's not the REST binding - that would be "webHttpBinding".

For the most part, WCF services ARE SOAP-based - any of the bindings except for the webHttpBinding are SOAP endpoints, so your wsHttpBinding endpoint is definitely not RESTful in any way, shape or form. You can communicate with it using e.g. SoapUI or better yet - the WcfTestClient in your Visual Studio folder.

You cannot however expect to get XML shaped data back from it by just browsing to that URL.

Marc


By default IIS 7.0 is not configured for WCF services, we are going to configure IIS 7.0 to run WCF services i will break up the whole procedure in steps.

http://basitblog.wordpress.com/2010/01/12/deploy-wcf-service-over-iis-7-0/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜