Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1413
  • Last Modified:

Hosting webservice in IIS

I am very new to WCF services and hosting anything in IIS. So take baby steps with me :).

I created a WCF service library and configured the end points using app.config.  I was able to test the service by hosting in WcfSvcHost and testing with WcfTestClient.

I then added a new web site application, ASP.NET web service, to my project and added a reference to my service library and configured my .svc file to point to my service library. Configured my end points by copying my app.config file into my project and renaming to web.config. I was able to host this by viewing in the broswer with ASP.NET development server.  I tested with WcfTestClient and it worked fine.

Now to my problem....

Then I wanted to host my web application in IIS.  So I added my web application to my default web site in IIS.  I pointed the physical path to my application directory and then verified that my .svc file and libraries were added correctly.  But when I tried to view my .svc in browser I got a 'HTTP 500 Internal Error'.  Why??? And how do I fix it??

Thanks!
Screen shot of IIS
0
MeritorWabco
Asked:
MeritorWabco
  • 11
  • 9
1 Solution
 
Randy DownsOWNERCommented:
You may have permissions problems. The easiest way to get the permissions right is to copy your site to the default web in inetpub.
0
 
MeritorWabcoAuthor Commented:
I moved my folder that contains my application to the inetpub/wwwroot directory.  Is that what you mean??


I was able to open the .svc file in browser but it just opened up as a blank page. Do you know why that would happen?  Could it be that I am not exposing my meta data correctly?  See my attached Web.config.
blank-page.png
Web.config
0
 
Randy DownsOWNERCommented:
yeah that's the right folder. Try opening a simple html page or just localhost
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MeritorWabcoAuthor Commented:
Not sure what you mean.  Are you wanting me to add an html page to my project? And then open that with the browser?  Or just right click the default web site and view in browser?  Like the image I attached?

 screen shot
0
 
MeritorWabcoAuthor Commented:
Here is what I see when I open my service in browser from my project using ASP.NET development server.

 Screen shot
0
 
Randy DownsOWNERCommented:
I'd just like to see something besides a blank page. Just add some text to a index.html & call it directly localhost/index.html. I suspect that it will work fine.
0
 
Randy DownsOWNERCommented:
I can't read your development server page very well but I'd try adding the suggested code & see what happens on the development server.
0
 
MeritorWabcoAuthor Commented:
You might have to download the images to see them.

In regards to viewing I don't know exactly what you mean.  Sorry I am new to html and web development.  But I added an HTML page to my project called Index.htm.  I was able to view the text in my development server but when I moved everything to the wwwroot directory to view it from IIS it still came up as a blank page when i tried to view index.htm in browser.
0
 
MeritorWabcoAuthor Commented:
I just tried to open the iisstart.htm file in wwwroot from IIS (http://localhost/iisstart.htm) it came up blank also.  But when i open the file directly (C:\inetpub\wwwroot\iisstart.htm) it opens fine.
0
 
Randy DownsOWNERCommented:
OK it sounds like your localhost is not setup properly. Try this - http://learn.iis.net/page.aspx/28/installing-iis-7-on-windows-vista-and-windows-7/
0
 
MeritorWabcoAuthor Commented:
Hey we made progress. I am open to open the html page and the local host.  

I got some errors that forced me to install some modules that I didn't install using the guide you had provided.  

The first error I got was HTTP Error 404.3 - Not Found. So i performed the following.
I ran ServiceModelReg -i from the command prompt from directory  "c:\windows\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\"

I tried it again and then I got HTTP Error 500.21 - Internal Server Error.  So I performed the following.
I ran aspnet_regiis.exe -i in VS 2010 command prompt.

Of course now when I open it I get another error.
'The type 'TestServiceLibrary.TestService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found. '

0
 
MeritorWabcoAuthor Commented:
I had to right right click the default web site node and select add application.  I had to point the physical path to my folder in wwwroot and now it opens up fine.  
0
 
Randy DownsOWNERCommented:
awesome. Glad you got it.
0
 
MeritorWabcoAuthor Commented:
Of course it opens in the browser but when I try to access it from WcfTestClient using 'http://localhost/TestSite/test.svc'  it doesn't work. I get the following error from WcfTestClient when trying to add the service 'Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.'

I must not be exposing my metadata end point correctly or accessing it correctly.

In my web.config i have my metadata endpoint defined as the following:
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
0
 
MeritorWabcoAuthor Commented:
That seems to be a different issue I appreciate your help with my IIS not being configured correctly.
0
 
MeritorWabcoAuthor Commented:
I am not sure if you are familiar with working with WCF or not but I still haven't been able to figure out my error I am facing.  500pt question if you can help. http://rdsrc.us/7VNt9o
0
 
MeritorWabcoAuthor Commented:
I have pretty much the exact same thing in that site for exposing the metadata endpoint along with the service behavior and I can l view the .svc file in the browser fine and expose the end points using the metadata in WcfTestClient.  The problem is when I hose my service in IIS instead of the ASP.NET development server I get an error when I try to connect to my service using WcfTestclient.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 11
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now