What am I doing wrong? (Deploy a simple WCF ASP.NET 3.51)

Discussion in 'ASP.NET WebServices' started by DigitalHealthcare, May 4, 2009.

  1. Hi,

    I'm new to DiscountASP and what I'm trying to do is rather simple:

    I have a MyService.DLL that works fine when run from VS2008 and when deployed in a Windows 7 Beta/IIS7, I have managed to make it work under IIS7 in Windows 7 by creating the "Web Application".

    Inside that Application (in Windows 7) the directory structure is:

    root
    /MyServiceApp
    /MyServiceApp/MyService.svc
    /MyServiceApp/Web.config
    /MyServiceApp/bin/MyService.dll

    If I go to mywindows7.com/MyServiceApp/MyService.svc, I get the usual WCF response. It works.

    I have tried to replicate this simple setup in DiscountASP to no avail.

    Here's what I did:

    I created a directory (via FTP) called MyService and replicated the same layout I have in my Windows 7 (posted above).

    I went to the control panel -> Web Application Tool, and set that "MyServiceApp" directory as an Application.

    When I browse to mydiscountaspurl.com/MyServiceApp/MyService.svc I get the contents of the svc file… ?

    My SVC file is rather simple (at least it works under Win7):

    <% @ServiceHost Service="SmsEngine.SmsEngineService" %>


    (Those are the real names by the way, in discountasp i've used the exact names I had on WIndows7, the other names used throughout this post are mere examples).

    My (relevant) web.config part is this:

    Code:
    <system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="MyBasicHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
              receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
              bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
              maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
              messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
              useDefaultWebProxy="true">
              <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384"
                maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
                <security mode="None">
                    <transport clientCredentialType="None" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <services>
    	<service behaviorConfiguration="SmsEngine.Service1Behavior" name="SmsEngine.SmsEngineService">
            	<endpoint 
    			binding="basicHttpBinding" 
    			bindingConfiguration="MyBasicHttpBinding" 
    			name="basicEndPoint" 
    			contract="SmsEngine.ISmsEngineService">
    			
    			<identity>
    				<dns value="windows7beta1" />
    		 	</identity>
    		
    		</endpoint>
    	</service>
    </services>
    <behaviors>
    	<serviceBehaviors>
    		<behavior name="SmsEngine.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>
    The *super* size numbers are for debug, I plan to reduce those accordingly. (those are the max values).

    What am I doing wrong?

    I just need the hosting to host that WCF, my "website" sits in the /root and has no ASP nor anything (just a bunch of html/css files and that works). But I need the "WCF" service.

    NOTE: I've changed the <identity> in discountasp to point to my "alternate" url, since my DNS has not yet propagated.

    Any ideas?

    Could it be that this doesn't work through the Alternate URL?

    Thanks
     
  2. Bruce

    Bruce DiscountASP.NET Staff

  3. Hi Bruce,

    Thanks for the link. Unfortunately, after following all the steps I still get the same response from the server. When I point to my svc file, i get the svc file back…

    Go ahead and try it:

    http://dentactilco.eweb702.discountasp.net/ServicesEngineWebSite/ServicesEngine.svc

    That should return the page which asks you to create a client with svcutil.exe, however I get the svc back as if it was a text file. My guess is that IIS is not reading the svc as a service. I *HAVE* followed every step up there (replacing with my names) and *have* "installed" the application through the control panel. The service runs locally (when in VS).

    There are a few mistakes in the tutorial, but nothing that you just don't see by taking a look at it.

    What else can I do? Thanks.
     
  4. Thanks for the link. However, after following the exact steps (minor some corrections, there are a few typos), I still get the same output from my service: The .svc contents!

    It looks as if IIS is *not* detecting the "application". Yes, I *have* installed it.

    After modifying my WCF to be just like the example, after following and checking all the steps a few times, I'm still getting the same thing.

    I have also uploaded the sample provided by the tutorial (modifying the <serviceHostingEnvironment>) and it ALSO, shows the svc contents!

    Here's the URI: http://dentactilco.eweb702.discountasp.net/EvalServiceWebSite/EvalService.svc

    Here's My URI:
    http://dentactilco.eweb702.discountasp.net/ServicesEngineWebSite/ServicesEngine.svc

    Both EvalServiceWebSite and ServicesEngineWebSite *are* applications according to the control panel.

    Any ideas? Thanks.
     
  5. After further investigation, the only thing that comes to my mind, is that this server has not registered the WCF with IIS, in which case, every reference in google points to executing:

    ServiceModelReg -i

    in a command line.

    I remember doing that in Windows 7 BETA1.

    Any ideas?
     
  6. BTW: I got all that information from google, here's a reference:

    http://blogs.msdn.com/wenlong/archive/2006/09/10/748294.aspx

    I have the DNSs updated now so I've changed all my config files to point to the REAL domain, and not the alternative one. Still no luck with either my WCF or the sample provided in the tutorial. Seeing the "plain text" svc file when accessing though the browser is frustrating as I can't even begin to test the WCF…
     
  7. Bruce

    Bruce DiscountASP.NET Staff

    this may be a configuration problem. i'll talk to the sysadmin and see.
     
  8. Thanks Bruce, I really don't know what else to do here.
     
  9. Bruce

    Bruce DiscountASP.NET Staff

    we confirmed this to be a config issue (problem w/ the silly .net 3.5 sp1 installer). We have manually re-enabled wcf over http.
     
  10. Great, thanks. The WCF appears to be working now! ;)
     
  11. How did you re-enable wcf over http? because i have the same problem on my server.
     
  12. problem with hosting WCF

    I am also experiencing the same problem. How did you get your WCF service to run?
     
  13. Thank you!!

    I was also recieving this same error and was able to resolve it using this article. :D:D:D It came down to my errors with my web config (also make sure you install an application using DASP Web Application Tool into your Web Service directory)

    Here is a copy of my working web.config

    Code:
    
    <?xml version="1.0"?>
    <configuration>
                  <!-- IF USING A DATABASE LIKE ME -->
    	<connectionStrings>
      <add name="YOUR_CONNECTION_NAME" connectionString="YOUR_CONNECTION_STRING (supplied by DASP)"
       providerName="System.Data.SqlClient" />
     </connectionStrings>
    	<system.web>
    		<compilation debug="false" targetFramework="4.0"/>
    	</system.web>
    	<system.serviceModel>
    		<services>
          
    			<service behaviorConfiguration="myBehave" name="YOUR_SERVICE.Service1">
    				<endpoint address="YOUR_SERVICE_Endpoint" 
                      binding="basicHttpBinding" contract="YOUR_SERVICE.IService1">
    				</endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    			</service>
    		</services>
        <serviceHostingEnvironment>
          <baseAddressPrefixFilters>
            <add prefix="http://YOUR_DOMAIN.COM" />
          </baseAddressPrefixFilters>
        </serviceHostingEnvironment>
    
        <behaviors>
    			<serviceBehaviors>
    				<behavior name="myBehave">
    					<serviceMetadata httpGetEnabled="True"/>
              <serviceDebug
                includeExceptionDetailInFaults="true"
              />
            </behavior>
    			</serviceBehaviors>
    		</behaviors>
    	</system.serviceModel>
    </configuration>
    
    
    
     

Share This Page