2012-04-27 4 views
2

다른 응용 프로그램이이 서비스 URL에 대한 http 요청을 작성하여 문자열을 검색 할 수있게 해주는 WCF 웹 서비스를 만들려고합니다. 나는 내가 URL, 을 사용하는 폴더의 경로를 확인 할 때 그것을배포 후 WCF 웹 서비스가 작동하지 않습니다.

' The resource cannot be found' 

을 말한다 내가 오류를 얻을 URL을 사용하여, 그것에 검색 할 때 IIS에서 서비스를 게시하고 시도

C:\inetpub\wwwroot\WcfServices\WcfSampleLibrary\WcfSampleLibrary.Service1 
C:\inetpub\wwwroot\WcfServices\WcfSampleLibrary\Web.config 
C:\inetpub\wwwroot\WcfServices\WcfSampleLibrary\bin\WcfSampleLibrary.dll 

웹 설정 파일 :

여기
'No protocol binding matches the given address 
'http://localhost:xxxx/WcfSampleLibrary/Service1/mex.' 
Protocol bindings are configured at the Site level in IIS or WAS configuration' 

게시 된 폴더의 디렉토리 경로입니다

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 

<system.web> 
    <compilation debug="true" /> 
</system.web> 
<system.serviceModel> 
<services> 
    <service name="WcfSampleLibrary.Service1" behaviorConfiguration ="mex"> 
    <host> 
     <baseAddresses> 
     <add baseAddress = "http://192.xxx.x.xxx/WcfSampleLibrary/Service1/" /> 
     </baseAddresses> 
    </host> 
    <!-- Service Endpoints --> 
    <endpoint address ="" 
     binding="wsHttpBinding" contract="WcfSampleLibrary.IService1"> 
    <identity> 
     <dns value="localhost"/> 
     </identity> 
    </endpoint> 
    <!-- Metadata Endpoints --> 
    <endpoint address="http://localhost:xxxx/WcfSampleLibrary/Service1/mex" name="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="mex"> 
    <serviceMetadata httpGetEnabled="false"/> 
     <!-- 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> 

IIS에서 호스팅되는 WCF 서비스에서

+0

동일한 컴퓨터에서 IIS에 게시 한 후 포트 'xxxx'에서 수신 대기합니까? – mellamokb

+0

당신의'baseAddress'는 여러분의 서비스 엔드 포인트'address'와 다릅니다. 보통'baseAddress'를 생략 할 수 있습니다. – Filburt

+0

포트를 설정하지 않았지만 서버 IP 주소 만 사용하려고했습니다. 그것은 포트 자체를 설정합니다 – vbNewbie

답변

3

당신이 주소를 전체 URI를 지정하지. IIS가 주소를 결정합니다. 또한 baseAddresses 요소는 IIS에서 호스팅 할 때 완전히 무시됩니다. 따라서 Web.config에서 제거하십시오.

<endpoint 
    address="mex" 
    binding="mexHttpBinding" 
    contract="IMetadataExchange" 
    /> 

그런 다음 주소가 http://IIS.SERVER/SiteName/Folder/WcfSampleLibrary.Service1.svc 것 : 서비스의 기본 주소는 WCF 서비스는이 같은 placed.Do의 뭔가가되는 웹 사이트 & 가상 디렉터리에 의해 결정된다. 주소가 무엇인지 확실하지 않은 경우 IIS 관리 도구를 사용하여 서비스가있는 사이트를 선택한 다음 마우스 오른쪽 단추를 클릭하고 고급 -> 사이트 찾아보기를 선택하십시오.

또한 WSDL을 게시하려는 경우 mex 동작에 대해 httpGetEnabled를 설정합니다. 이것은 당신이 그것을 개발로보다 쉽게 ​​서비스를 소비 할 수 있습니다 :

<behaviors> 
    <serviceBehaviors> 
    <behavior name="mex" > 
     <serviceMetadata httpGetEnabled="true" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

서비스에 검색에있는 httpGetEnabled로 URI는 당신에게 WSDL을 볼 수있는 옵션을 제공합니다.

+0

설명에 감사드립니다 ... 변경 사항을 시도했지만 이제는 오류 : IIS에서 찾아보기 사이트를 사용할 때 웹 서버가이 디렉터리의 내용을 나열하지 않도록 구성되었습니다. 브라우저에 전체 URL을 수동으로 입력하면 resouce를 찾을 수 없습니다. 이것은 단지 보안/공유 문제입니다. 또한 – vbNewbie

+0

IT 관리자는 디렉터리의 내용을 나열하지 않을 수 있지만 IIS 관리자에서 웹 서버가 호스팅하는 URI를 가져옵니다. 웹 폴더에 어떤 파일이 있습니까? 'ServiceName.svc' 파일이 있습니까? –

+0

서비스 파일이 웹 폴더에 없습니다. bin 폴더에 WcfSampleLibrary.dll이 있고 주 폴더에 web.config 파일이 있습니다. 수동으로 서비스 파일을 추가해야합니까? – vbNewbie

관련 문제