我在这里疯了 - 我第六天试图解决这个问题并且我已经失去了理智。
基本上在内部,该服务按预期工作100%。我创造了一个"消费"在我的外部测试线上的客户端,我去测试它,它返回
"The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (multipart/related; type=\"application/xop+xml\"). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<HTML>
<HEAD>
<link rel=\"alternate\" type=\"text/xml\" href=\"http://myexternaladdress.com/FileUploadService.svc?disco\"/>
<STYLE type=\"text/css\">
#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}</STYLE>
<TITLE>
FileUploadService Service</TITLE>
</HEAD>
<BODY>
<DIV id=\"co'."}
基本上这就是我得到的所有问题与迪斯科http://myexternaladdress.com/FileUploadService.svc?disco
这是我的服务.config
<?xml version="1.0"?>
<configuration>
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
>
<listeners>
<add name="xml"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\temp\WCFDiagnosticsExample.svclog" />
</sharedListeners>
</system.diagnostics>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="uploadDirectory" value="C:\temp\upload" />
</appSettings>
<system.web>
<compilation targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<diagnostics>
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"
/>
</diagnostics>
<extensions>
<behaviorExtensions>
<add name="applyAddressFilterModeBehavior"
type="Test.Behaviors.ApplyAddressFilterModeBehaviorElement, Test.Behaviors,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</behaviorExtensions>
</extensions>
<services>
<service behaviorConfiguration="myBehavior" name="myWCF.FileUploadService">
<endpoint address="" binding="wsHttpBinding" contract="myWCF.IFileUploadService" bindingConfiguration="myBinding"></endpoint>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="myBinding" messageEncoding="Mtom" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None"/>
</binding>
</wsHttpBinding>
<basicHttpBinding>
<binding name="FileUploadServiceBinding" transferMode="Streamed" messageEncoding="Mtom" maxReceivedMessageSize="99108864" maxBufferSize="65536" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="myBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
<applyAddressFilterModeBehavior/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="204800000"></requestLimits>
</requestFiltering>
</security>
</system.webServer>
</configuration>
唯一的区别是当我来到外部时,我通过我的外部地址添加服务,该地址通过负载均衡器并重定向到https,然后将流量发送到特定的服务器和端口。我甚至可以.Open
我的服务很好。我调用方法时发生错误。有人可以告诉我如何检索不仅仅是1024个字符的完整信息或指出我做错了什么?
我尝试添加enabledhttps和httpsuri,但没有解决问题。
谢谢!我非常感谢谁能帮助我解决这个问题。
答案 0 :(得分:0)
您的服务的绑定似乎使用wsHttpBinding绑定。绑定的目的是什么叫 FileUploadServiceBinding ?它似乎没有使用。
您的WCF服务可能会出现异常。如果将这些行添加到服务主机的web.config文件中,则可以获取错误详细信息。
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Critical, Error" propagateActivity="true">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="c:\error.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
在web.config中添加这些行后,再次执行您的客户端应用程序。如果发生异常,则在 error.svclog 文件中写入异常详细信息。您可以使用.Net Framework的svclog util来检查错误详细信息。