【发布时间】:2014-05-27 07:31:06
【问题描述】:
我没有找到任何有用的信息,所以我写在这里:
我创建了一个在开发中运行良好的 WCF 服务应用程序,但是当我部署它时,我在 IIS (7.0) 上收到此错误:
ServiceMetadataBehavior的HttpsGetEnabled属性设置为true,HttpsGetUrl属性是相对地址,但是没有https基地址。提供 https 基地址或将 HttpsGetUrl 设置为绝对地址。
应用程序是 .Net FW 4.0,IIS 应用程序池是 ASP.NET v4.0
web.config:
<service name="ServiceName.Service1">
<endpoint address=""
behaviorConfiguration="restfulBehavior"
binding="webHttpBinding"
contract="ServiceName.IServiceApp"/>
</service>
<serviceMetadata httpGetEnabled="true"
httpGetUrl="http://localhost:10001/ServiceName"
httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
希望有人可以帮助解决这个问题。
Windows Event Log:
Log Name: Application
Source: System.ServiceModel 4.0.0.0
Date: 28.5.2014 0:11:19
Event ID: 3
Task Category: WebHost
Level: Error
Keywords: Classic
User: IIS APPPOOL\ASP.NET v4.0
Computer: Server.domain.local
Description:
WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/3486411
Exception: System.ServiceModel.ServiceActivationException: The service '/ServiceApp/ServiceName.svc' cannot be activated due to an exception during compilation. The exception message is: The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address. Either supply an https base address or set HttpsGetUrl to an absolute address.. ---> System.InvalidOperationException: The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address. Either supply an https base address or set HttpsGetUrl to an absolute address.
at System.ServiceModel.Description.ServiceMetadataBehavior.EnsureGetDispatcher(ServiceHostBase host, ServiceMetadataExtension mex, Uri url, String scheme)
at System.ServiceModel.Description.ServiceMetadataBehavior.CreateHttpGetEndpoints(ServiceDescription description, ServiceHostBase host, ServiceMetadataExtension mex)
at System.ServiceModel.Description.ServiceMetadataBehavior.ApplyBehavior(ServiceDescription description, ServiceHostBase host)
at System.ServiceModel.Description.ServiceMetadataBehavior.System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
at System.ServiceModel.ServiceHostBase.InitializeRuntime()
at System.ServiceModel.ServiceHostBase.OnBeginOpen()
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
--- End of inner exception stack trace ---
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
Process Name: w3wp
Process ID: 4520
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="System.ServiceModel 4.0.0.0" />
<EventID Qualifiers="49154">3</EventID>
<Level>2</Level>
<Task>5</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2014-05-27T22:11:19.000000000Z" />
<EventRecordID>64475</EventRecordID>
<Channel>Application</Channel>
<Computer>Server.domain.local</Computer>
<Security UserID="bla bla bla" />
</System>
<EventData>
<Data>System.ServiceModel.ServiceHostingEnvironment+HostingManager/3486411</Data>
<Data>System.ServiceModel.ServiceActivationException: The service '/ServiceApp/ServiceName.svc' cannot be activated due to an exception during compilation. The exception message is: The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address. Either supply an https base address or set HttpsGetUrl to an absolute address.. ---> System.InvalidOperationException: The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address. Either supply an https base address or set HttpsGetUrl to an absolute address.
at System.ServiceModel.Description.ServiceMetadataBehavior.EnsureGetDispatcher(ServiceHostBase host, ServiceMetadataExtension mex, Uri url, String scheme)
at System.ServiceModel.Description.ServiceMetadataBehavior.CreateHttpGetEndpoints(ServiceDescription description, ServiceHostBase host, ServiceMetadataExtension mex)
at System.ServiceModel.Description.ServiceMetadataBehavior.ApplyBehavior(ServiceDescription description, ServiceHostBase host)
at System.ServiceModel.Description.ServiceMetadataBehavior.System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
at System.ServiceModel.ServiceHostBase.InitializeRuntime()
at System.ServiceModel.ServiceHostBase.OnBeginOpen()
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
--- End of inner exception stack trace ---
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)</Data>
<Data>w3wp</Data>
<Data>4520</Data>
</EventData>
</Event>
【问题讨论】:
-
httpsGetUrl不应该以https:开头吗? -
是的,也尝试过(编辑),但没有帮助仍然是同样的错误,比如它没有读取我什至搜索过的设置,如果我在应用程序的其他地方有 ServiceMetadata 但没有。所以它有点像 IIS 没有从配置文件中读取设置
-
添加了端点配置由于某种原因不能将整个 webconfig 放在这里。希望它可以帮助有人帮助我解决这个问题