简体   繁体   中英

WCF service works in WCF Client but not in IIS

I have a WCF service that uses Microsoft.Synchronization.SyncAgent to synchronize a database on an Windows CE device. It works great when I run the service from Visual Studio 2008 but when I host it in IIS (using Windows 10 by the way), the sync fails with a TargetInvocationException. If I browse to the service with http://192.168.1.34:8711/InventoryCacheSyncService/InventoryServiceLibrary.InventoryCacheSyncService.svc I get the expected "You have created a service." page, but if I use http://192.168.1.34:8711/InventoryCacheSyncService/WTF which is the endpoint for the service just mentioned (as well as the url for the client web reference) I get a 404 error - although that url works fine when hosting it in Visual Studio's WCF Test Client. I have tried just about every alteration I can think of to the url in the Win CE client but I'm getting nowhere. I'm new to WCF services, so obviously I'm missing something incredible simple. Here's my web.config file:

web.config

PLEASE help me out if have any ideas. Thanks!

You can do below steps to host WCF in simple steps

  1. Goto Properties of application in visual studio
  2. Click on Web tab
  3. Select radio button "Use Local IIS Web server"
  4. Click on "Create Virtual directory" button

Virtual Directory will be created to your local system.

If want to host WCF in some other server, you can copy same folders to server and can create Virtual directory with same kind of physical path

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