Я создал веб-службу ssl / https, которая размещена в консольном приложении.
Для 127.0.0.1:8741 я добавил сертификат и использую https://127.0.0.1:8741/MagazinService/ в качестве конечной точки. Я использую Visual Studio Web Development Server для клиента Silverlight 4. Также консольное приложение, в котором размещается веб-служба, запускается из Visual Studio. Я не использую IIS вообще. Я успешно добавил сервисную ссылку в клиент Silverlight, но при вызове операций с сервера я получаю междоменную ошибку.
Я прочитал о clientaccesspolicy.xml и crossdomain.xml и добавил эти файлы в целом решение, и оно не работает.
Я застрял! Пожалуйста помоги! Вот код, который я использую:
app.config в консольном приложении (сервер / хост):
<system.serviceModel>
<services>
<service behaviorConfiguration="MagazinServiceBehavior" name="SOAP.MagazinVirtual">
<endpoint address="" binding="customBinding" bindingConfiguration="MagazinServiceBinding" contract="SOAP.IMagazinVirtual">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://127.0.0.1:8741/MagazinService/" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<customBinding>
<!-- buffer: 64KB; max size: 64MB -->
<binding name="MagazinServiceBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
<security authenticationMode="UserNameOverTransport" />
<binaryMessageEncoding>
</binaryMessageEncoding>
<httpsTransport>
</httpsTransport>
</binding>
</customBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MagazinServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add scheme="https" port="443" />
</defaultPorts>
</useRequestHeadersForMetadataAddress>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="SOAP.Validator, SOAP" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
здесь
ServiceReferences.ClientConfig
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_IMagazinVirtual">
<security authenticationMode="UserNameOverTransport" includeTimestamp="true">
<secureConversationBootstrap />
</security>
<binaryMessageEncoding />
<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://127.0.0.1:8741/MagazinService/" binding="customBinding"
bindingConfiguration="CustomBinding_IMagazinVirtual" contract="ServiceReference.IMagazinVirtual"
name="CustomBinding_IMagazinVirtual" />
</client>
</system.serviceModel>
Вот код из веб-проекта silverlight, Web.config:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_IMagazinVirtual">
<security defaultAlgorithmSuite="Default" authenticationMode="UserNameOverTransport"
requireDerivedKeys="true" securityHeaderLayout="Strict" includeTimestamp="true"
keyEntropyMode="CombinedEntropy" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
<localClientSettings cacheCookies="true" detectReplays="false"
replayCacheSize="900000" maxClockSkew="00:05:00" maxCookieCachingTime="Infinite"
replayWindow="00:05:00" sessionKeyRenewalInterval="10:00:00"
sessionKeyRolloverInterval="00:05:00" reconnectTransportOnFailure="true"
timestampValidityDuration="00:05:00" cookieRenewalThresholdPercentage="60" />
<localServiceSettings detectReplays="false" issuedCookieLifetime="10:00:00"
maxStatefulNegotiations="128" replayCacheSize="900000" maxClockSkew="00:05:00"
negotiationTimeout="00:01:00" replayWindow="00:05:00" inactivityTimeout="00:02:00"
sessionKeyRenewalInterval="15:00:00" sessionKeyRolloverInterval="00:05:00"
reconnectTransportOnFailure="true" maxPendingSessions="128"
maxCachedCookies="1000" timestampValidityDuration="00:05:00" />
<secureConversationBootstrap />
</security>
<binaryMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
maxSessionSize="2048">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binaryMessageEncoding>
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" requireClientCertificate="false" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://127.0.0.1:8741/MagazinService/" binding="customBinding"
bindingConfiguration="CustomBinding_IMagazinVirtual" contract="ServiceReference.IMagazinVirtual"
name="CustomBinding_IMagazinVirtual" />
</client>
</system.serviceModel>
Это код для clientaccesspolicy.xml
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="http://*" />
<domain uri="https://*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
А это код для crossdomain.xml
<?xml version="1.0" encoding="utf-8" ?>
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="SOAPAction" secure="true" />
</cross-domain-policy>
Мне трудно с этим, пожалуйста, помогите!