IISにSSL証明書をインストールしました。
次に、ドメインに移動すると https://www.example.com/ ページが正しく読み込まれます。しかし、httpsを介してWebサービス(通常はhttpで完璧に機能します)にアプローチしようとすると、次のようになります。 https://www.example.com/service.svc/newprofile/?id=8&ipaddress=124.162.13.109 =得る:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /service.svc/newprofile/
こちらもチェック
ただし、webHttpBinding
をbasicHttpBinding
に名前変更すると、jsonpと組み合わせてサポートされていないエラーがスローされます。また、web.configのサービス要素名は、私の契約を実装するクラスの完全修飾名と一致します。
これが私のweb.configです
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<webHttpBinding>
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true">
</binding>
<binding name="webHttpsBindingWithJsonP" crossDomainScriptAccessEnabled="true">
<security mode="Transport"></security>
</binding>
</webHttpBinding>
</bindings>
<client />
<services>
<service name="RestService.service">
<endpoint behaviorConfiguration="webHttp" binding="webHttpBinding" contract="RestService.Iservice" />
<endpoint address="/service.svc" binding="webHttpBinding" bindingConfiguration="webHttpBindingWithJsonP" contract="RestService.Iservice" />
<endpoint address="/service.svc" binding="webHttpBinding" bindingConfiguration="webHttpsBindingWithJsonP" contract="RestService.Iservice" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp />
</behavior>
<behavior name="webHttpBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
私はwsdlをチェックしました: http://www.example.com/service.svc?wsdl
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.Microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://www.example.com/service.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://www.example.com/service.svc?xsd=xsd1" namespace="http://schemas.Microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://www.example.com/service.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/RestService"/>
<xsd:import schemaLocation="http://www.example.com/service.svc?xsd=xsd3" namespace="http://schemas.Microsoft.com/Message"/>
<xsd:import schemaLocation="http://www.example.com/service.svc?xsd=xsd4" namespace="http://schemas.datacontract.org/2004/07/AjaxControlToolkit"/>
<xsd:import schemaLocation="http://www.example.com/service.svc?xsd=xsd5" namespace="http://schemas.Microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Iservice_newProfile_InputMessage">
<wsdl:part name="parameters" element="tns:newProfile"/>
</wsdl:message>
Httpsをチェックすると: https://www.example.com/service.svc?wsdl
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.Microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="service" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="https://www.example.com/service.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="https://www.example.com/service.svc?xsd=xsd1" namespace="http://schemas.Microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="https://www.example.com/service.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/RestService"/>
<xsd:import schemaLocation="https://www.example.com/service.svc?xsd=xsd3" namespace="http://schemas.Microsoft.com/Message"/>
<xsd:import schemaLocation="https://www.example.com/service.svc?xsd=xsd4" namespace="http://schemas.datacontract.org/2004/07/AjaxControlToolkit"/>
<xsd:import schemaLocation="https://www.example.com/service.svc?xsd=xsd5" namespace="http://schemas.Microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Iservice_newProfile_InputMessage">
<wsdl:part name="parameters" element="tns:newProfile"/>
</wsdl:message>
この場合のサービスは次のように定義されます。
<OperationContract()> _
<Web.WebInvoke(Method:="GET", ResponseFormat:=Web.WebMessageFormat.Json, BodyStyle:=Web.WebMessageBodyStyle.Bare, _
UriTemplate:="newprofile/?id={id}&ipaddress={ipaddress}")> _
Function newProfile(ByVal Id As String, Optional ByVal IPAddress As String = "") As service.Profile
私のウェブサービス
Namespace RestService
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
Public Class service
Implements Iservice
'my code
End Class
End Namespace
私もweb.configでトレースを有効にしました。ここにログの一部があります(SOではすべてを投稿することはできません)。
<E2ETraceEvent
xmlns="http://schemas.Microsoft.com/2004/06/E2ETraceEvent">
<System
xmlns="http://schemas.Microsoft.com/2004/06/windows/eventlog/system">
<EventID>262155</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2014-10-27T19:07:08.0773174Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{f7c83e1b-3e28-4e4f-8978-23f5073be422}" />
<Execution ProcessName="w3wp" ProcessID="1428" ThreadID="19" />
<Channel/>
<Computer>MYPC</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord
xmlns="http://schemas.Microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
<TraceIdentifier>http://msdn.Microsoft.com/nl-NL/library/System.ServiceModel.Channels.HttpChannelMessageReceiveFailed.aspx</TraceIdentifier>
<Description>Failed to lookup a channel to receive an incoming message. Either the endpoint or the SOAP action was not found.</Description>
<AppDomain>/LM/W3SVC/1/ROOT-2-130589104148009222</AppDomain>
<Source>System.ServiceModel.Activation.HostedHttpTransportManager/33997547</Source>
<ExtendedData
xmlns="http://schemas.Microsoft.com/2006/08/ServiceModel/StringTraceRecord">
<IsRecycling>False</IsRecycling>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
<E2ETraceEvent
xmlns="http://schemas.Microsoft.com/2004/06/E2ETraceEvent">
<System
xmlns="http://schemas.Microsoft.com/2004/06/windows/eventlog/system">
<EventID>131074</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2014-10-27T19:07:08.0803197Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
<Execution ProcessName="w3wp" ProcessID="1428" ThreadID="19" />
<Channel/>
<Computer>MYPC</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord
xmlns="http://schemas.Microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
<TraceIdentifier>http://msdn.Microsoft.com/nl-NL/library/System.ServiceModel.Diagnostics.EventLog.aspx</TraceIdentifier>
<Description>Wrote to the EventLog.</Description>
<AppDomain>/LM/W3SVC/1/ROOT-2-130589104148009222</AppDomain>
<ExtendedData
xmlns="http://schemas.Microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord">
<CategoryID.Name>EventLogCategory</CategoryID.Name>
<CategoryID.Value>5</CategoryID.Value>
<InstanceID.Name>EventId</InstanceID.Name>
<InstanceID.Value>3221356547</InstanceID.Value>
<Value0>System.ServiceModel.Activation.HostedHttpRequestAsyncResult/52951402</Value0>
<Value1>System.Web.HttpException (0x80004005): There was no channel actively listening at 'https://www.example.com/service.svc/newprofile/?id=8&amp;ipaddress=25.62.133.109'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. ---&gt; System.ServiceModel.EndpointNotFoundException: There w
httpとhttpsの両方でこのサービスを利用できるようにしたい
Web.configとglobal.asax.vbも確認しましたが、IISではなく、httpsリクエストに対して特に何もしていません...この問題は何ですか?
[〜#〜]更新[〜#〜]
わかりました、いくつかのエンドポイントを削除し、エンドポイントのアドレス値の下に何を提供するかを理解しようとしています。以下のこの設定では、エラーが発生します:The endpoint at 'http://<pcname>/service.svc' does not have a Binding with the None MessageVersion. 'System.ServiceModel.Description.WebHttpBehavior' is only intended for use with WebHttpBinding or similar bindings.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<webHttpBinding>
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true">
<security mode="Transport"></security>
</binding>
</webHttpBinding>
<wsHttpBinding>
<binding name="wsHttpBinding" >
<security mode="Transport">
</security>
</binding>
</wsHttpBinding>
</bindings>
<client />
<services>
<service name="RestService.service">
<endpoint behaviorConfiguration="webHttp" binding="webHttpBinding" contract="RestService.Iservice" />
<endpoint behaviorConfiguration="webHttp" binding="wsHttpBinding" contract="RestService.Iservice" />
<!--
<endpoint address="/service.svc" binding="webHttpBinding" bindingConfiguration="webHttpBindingWithJsonP" contract="RestService.Iservice" />
-->
<!--
<endpoint behaviorConfiguration="webHttp" binding="webHttpBinding" contract="RestService.Iservice" />
<endpoint address="/service.svc" binding="webHttpBinding" bindingConfiguration="webHttpBindingWithJsonP" contract="RestService.Iservice" />
-->
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp />
</behavior>
<behavior name="webHttpBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
@Flo、最後に私はそれを機能させることができます。私は<endpoint behaviorConfiguration ..
を更新して<service behaviorConfiguration=..
を設定しましたが、うまくいきました。つまり、http
とhttps
の両方のバージョンのwww.example.com/service.svc/newprofile/?id=8&ipaddress=124.162.13.109
をヒットすると、出力を修正します。以下は、system.serviceModel
のweb.config
部分です。それでも機能しない場合は、ぜひお試しください。
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<webHttpBinding>
<binding name="Binding" crossDomainScriptAccessEnabled="true">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
<binding name="httpbind" crossDomainScriptAccessEnabled="true">
</binding>
</webHttpBinding>
</bindings>
<client />
<services>
<service name="RestService.service" behaviorConfiguration="ServiceBehaviour">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="Binding" contract="RestService.Iservice" behaviorConfiguration="web">
</endpoint>
<endpoint address="" binding="webHttpBinding" bindingConfiguration="httpbind" contract="RestService.Iservice" behaviorConfiguration="web">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="web">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
これらの種類のWebサービスは、アクセスにHTTPまたはHTTPSのどちらを使用しているかに非常に敏感です。
これを使用して、web.configでWCFサービスのSSLを有効にします。
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding>
<security mode="Transport" />
同様の問題が発生しました。詳細については、この質問への回答を参照してください: Windows Server 2012のASP.NET WebサイトをIIS 8に移動しました...サービスが見つかりません:。 svcファイルは表示可能ですが、それらのメソッドは404 を提供します