#vb.net #wcf #deployment #service
#vb.net #wcf #развертывание #Обслуживание
Вопрос:
У меня есть WCF в VB, который должен быть размещен в службе Windows. Я управлял программой установки, поэтому служба действительно устанавливается. Но, когда я пытаюсь запустить службу, я получаю следующую ошибку:
«Служба на локальном компьютере запустилась, а затем остановилась. Некоторые службы автоматически останавливаются, если им нечего делать, например, служба журналов производительности и оповещений.»
Проверка средства просмотра событий дает мне следующее:
Служба не может быть запущена. Система.Исключение InvalidOperationException: не удалось найти базовый адрес, который соответствует схеме http для конечной точки с привязкой wsHttpBinding. Схемы зарегистрированных базовых адресов []. at … at… at…
Что, я предполагаю, привело бы к моей проблеме где-то здесь:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<system.serviceModel>
<services>
<service name="ExStreamWCF.Service1" behaviorConfiguration="ExStreamWCF.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="wsHttpBinding" contract="ExStreamWCF.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ExStreamWCF.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- 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="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Однако, как абсолютный новичок, я понятия не имею, что может быть не так. Все это действительно ново для меня. Любое направление было бы с благодарностью!
Спасибо, Джейсон
fdsa
Ответ №1:
добавьте базовый адрес как:
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost/ExStreamWCF" />
</baseAddresses>
</host>
Ответ №2:
Поскольку вы используете автономный хостинг, вам необходимо указать адрес для прослушивания вашей службой. Если вы размещены в IIS, IIS контролирует адрес, но в сценариях с самостоятельным размещением вы должны указать адрес в этом элементе конфигурации:
<endpoint address="" binding="wsHttpBinding" contract="ExStreamWCF.IService1">