我目前在只能通过https访问的域上提供图像内容.在通过http访问的页面上使用https路径提供图像的缺点是什么?有任何缓存注意事项吗?我正在使用HttpRuntime.Cache对象来存储从数据库中检索的绝对图像路径.
我假设如果图像只能通过https访问,那么使用协议相对URL没有任何好处吗?
有没有令人信服的理由为什么我应该设置一个单独的虚拟目录来通过http提供图像内容?
我正在尝试开发一个Web应用程序,使用WCF向Web服务提交一个简单的登录请求,但我不断收到"内容类型文本/响应消息的明文不匹配"错误,即使Web服务似乎正在返回有效的XML.
我已经回顾了有关此错误的数十篇类似的SO帖子,并排除了更常见的可能性:
还有什么可能导致我的错误,为什么这不被认为是有效的XML?
我正在为我的应用程序使用.Net 4.0和Visual Studio 2010,它在单独的服务器上与Java/Tomcat Web服务进行通信.
以下是我的登录代码的相关摘录:
AuthenticationServiceClient client = new AuthenticationServiceClient(strPortName, strURL);
client.Open();
UserCredentials credentials = new UserCredentials();
credentials.userName = TestUsername;
credentials.password = TestPassword;
LoginResponse response = client.login(credentials); // Using WCF.
Run Code Online (Sandbox Code Playgroud)
这是绑定在我的Web.Config中的样子:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="AuthenticationServiceSoapBinding" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://mywebserviceurl"
binding="basicHttpBinding" bindingConfiguration="AuthenticationServiceSoapBinding"
contract="MyNamespace.AuthenticationService" name="AuthenticationServiceImplPort" />
</client>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
这是我的错误信息:
在"WebServiceURL"上测试与Web服务的连接时出错:System.ServiceModel.ProtocolException:响应消息的内容类型text/plain与绑定的内容类型(text/xml; charset = utf-8)不匹配.如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法.响应的前788个字节是:'
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<loginReponse xmlns="urn:xxxx">
<authKey>xxxx</authKey>
<authMetadata>
<IPaddress>https://MyWebApplicationURL</IPaddress>
<loginTimestamp>xxxx</loginTimestamp><levelOfAssurance>
<AuthMechanism>xxxx</AuthMechanism>
<VettingAssertion>xxxx</VettingAssertion>
</levelOfAssurance> …Run Code Online (Sandbox Code Playgroud)