在一个wpf后台窗体做了一个打开和停止“ServiceHost”的操作,在没有退出窗体的时候点击启动-停止,再点击启动的时候报错:
求解答。此程序是HTTP访问。
把你的WCF 配置发 过来。不过应该是你没有 指定证书导致的
<?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> <connectionStrings> <add name="ConnectionString" connectionString="server=192.168.1.100;Database=shop;userid=root;password=123456;port=3306;Charset=utf8"/> <add name="WeacherUrlString" connectionString="http://apis.baidu.com/heweather/pro/weather"/> <add name="LocalCityString" connectionString="beijing"/> <add name="FtpName" connectionString="admin"/> <add name="FtpPwd" connectionString="admin"/> <add name="FtpServerIP" connectionString="Ftp://192.168.13.180/"/> <add name="FtpMaterialPath" connectionString="\processed\" /> </connectionStrings> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="basicHttpBinding_IResource" maxBufferPoolSize="999999999" maxReceivedMessageSize="999999999" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> </binding> <binding name="basicHttpBinding_IMap" maxBufferPoolSize="999999999" maxReceivedMessageSize="999999999" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> </binding> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="ExposeMetaDataSellerBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Seller/MEX" /> </behavior> <behavior name="ExposeMetaDataCategoryBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Category/MEX" /> </behavior> <behavior name="ExposeMetaDataActivityBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Activity/MEX" /> </behavior> <behavior name="ExposeMetaDataUserBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/User/MEX" /> </behavior> <behavior name="ExposeMetaDataResourceBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Resource/MEX" /> </behavior> <behavior name="ExposeMetaDataAdvertBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Advert/MEX" /> </behavior> <behavior name="ExposeMetaDataAdvertPositionBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/AdvertPosition/MEX" /> </behavior> <behavior name="ExposeMetaDataOperationBehavior" > <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Operation/MEX" /> <dataContractSerializer maxItemsInObjectGraph="2147483647" /> </behavior> <behavior name="ExposeMetaDataWeatherBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Weather/MEX" /> </behavior> <behavior name="ExposeMetaDataFloorBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Floor/MEX" /> </behavior> <behavior name="ExposeMetaDataLocationBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Location/MEX" /> </behavior> <behavior name="ExposeMetaDataConfigBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Config/MEX" /> </behavior> <behavior name="ExposeMetaDataMapBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/Map/MEX" /> </behavior> <behavior name="ExposeMetaDataMapCategoryBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl="http://locahost:4567/MapCategory/MEX" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/> <services> <service behaviorConfiguration="ExposeMetaDataSellerBehavior" name="ShopService.SellerOperDecorator"> <endpoint address="http://locahost:4567/SellerService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.ISeller" /> </service> <service behaviorConfiguration="ExposeMetaDataCategoryBehavior" name="ShopService.CategoryOperDecorator"> <endpoint address="http://locahost:4567/CategoryService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.ICategory" /> </service> <service behaviorConfiguration="ExposeMetaDataActivityBehavior" name="ShopService.ActivityOperDecorator"> <endpoint address="http://locahost:4567/ActivityService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.IActivity" /> </service> <service behaviorConfiguration="ExposeMetaDataUserBehavior" name="ShopService.UserOperDecorator"> <endpoint address="http://locahost:4567/UserService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.IUser" /> </service> <service behaviorConfiguration="ExposeMetaDataAdvertBehavior" name="ShopService.AdvertOperDecorator"> <endpoint address="http://locahost:4567/AdvertService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.IAdvert" /> </service> <service behaviorConfiguration="ExposeMetaDataAdvertPositionBehavior" name="ShopService.AdvertPositionOperDecorator"> <endpoint address="http://locahost:4567/AdvertPositionService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.IAdvertPosition" /> </service> <service behaviorConfiguration="ExposeMetaDataOperationBehavior" name="ShopService.OperationImplementation"> <endpoint address="http://locahost:4567/OperationService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.IOperation" /> </service> <service behaviorConfiguration="ExposeMetaDataResourceBehavior" name="ShopService.ResourceOperDecorator"> <endpoint address="http://locahost:4567/ResourceService" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_IResource" contract="ShopInterface.IResource" /> </service> <service behaviorConfiguration="ExposeMetaDataFloorBehavior" name="ShopService.FloorImplementation"> <endpoint address="http://locahost:4567/FloorService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.IFloor" /> </service> <service behaviorConfiguration="ExposeMetaDataWeatherBehavior" name="ShopService.WeatherImplementation"> <endpoint address="http://locahost:4567/WeatherService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.IWeather" /> </service> <service behaviorConfiguration="ExposeMetaDataLocationBehavior" name="ShopService.LocationImplementation"> <endpoint address="http://locahost:4567/LocationService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.ILocation" /> </service> <service behaviorConfiguration="ExposeMetaDataConfigBehavior" name="ShopService.ConfigImplementation"> <endpoint address="http://locahost:4567/ConfigService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.IConfig" /> </service> <service behaviorConfiguration="ExposeMetaDataMapBehavior" name="ShopService.MapImplementaion"> <endpoint address="http://locahost:4567/MapService" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_IMap" contract="ShopInterface.IMap" /> </service> <service behaviorConfiguration="ExposeMetaDataMapCategoryBehavior" name="ShopService.MapCategoryImplementation"> <endpoint address="http://locahost:4567/MapCategoryService" binding="basicHttpBinding" bindingConfiguration="" contract="ShopInterface.IMapCategory" /> </service> </services> </system.serviceModel> </configuration>
确实没有指定证书,不知道该怎么指定。网上都是说tcp我是httP写上还有错。