我的App.config:如何發佈WCF Rest Webservice?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="WcfJsonRestService.Service1">
<endpoint address="http://localhost/webservice"
binding="webHttpBinding"
contract="WcfJsonRestService.IService1"/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
我發表我的web服務的http://localhost/webservice
目標,但是當我在瀏覽器中打開http://localhost/webservice/
我得到這個:
localhost - /webservice/
[To Parent Directory]
11/9/2015 10:30 AM <dir> bin
11/9/2015 11:23 AM 58 WcfJsonRestService.Service1.svc
11/9/2015 11:22 AM 481 Web.config
這在調試模式下運行良好。我只是http://localhost/webservice/getUsers
,我收到了一個用戶列表。當我將web服務發佈到IIS時發生問題,因爲http://localhost/webservice/getUsers
返回HTTP Error 404.0 - Not Found
。
有什麼建議嗎?
網站是否有認證的IIS?在「connect as」中檢查您網站的基本設置 –
@Rgdent我有「應用程序用戶(傳遞身份驗證)」選項。 – Christopher
是旁邊的「連接爲...」點擊「測試設置...」應該有兩個結果:「身份驗證」和「授權」,他們都應該旁邊有一個綠色的對勾。 –