Temp权限引起的WCF问题

WCF按照BasicHttpBinding方式发布,部署到服务器上,再在其他项目中引用的时候,就会出现不能正确下载元数据的错误。使用svcutil.exe工具进行测试,出现下面的问题。在Log跟踪中看到:

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent%22> 
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system%22> 
<EventID>131075</EventID> 
<Type>3</Type> 
<SubType Name="Error">0</SubType> 
<Level>2</Level> 
<TimeCreated SystemTime="2009-09-10T08:28:29.0217396Z" /> 
<Source Name="System.ServiceModel" /> 
<Correlation ActivityID="{00000000-0000-0000-0f00-0060010000fb}" /> 
<Execution ProcessName="w3wp" ProcessID="5628" ThreadID="5" /> 
<Channel /> 
<Computer>OA-HRPAYOPR</Computer> 
</System> 
<ApplicationData> 
<TraceData> 
<DataItem> 
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord%22 Severity="Error"> 
<TraceIdentifier>http://msdn.microsoft.com/zh-CN/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier> 
<Description>Throwing an exception.</Description> 
<AppDomain>/LM/W3SVC/1688268109/Root-1-128970447760280025</AppDomain> 
<Exception> 
<ExceptionType>System.ServiceModel.ProtocolException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> 
<Message>Content Type application/soap+xml; charset=utf-8 was sent to a service expecting text/xml; charset=utf-8.  The client and service bindings may be mismatched.</Message> 
<StackTrace> 
at System.ServiceModel.Channels.HttpInput.ThrowHttpProtocolException(String message, HttpStatusCode statusCode, String statusDescription) 
at System.ServiceModel.Channels.HttpInput.ValidateContentType() 
at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception&amp; requestException) 
at System.ServiceModel.Channels.HttpRequestContext.CreateMessage() 
at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, ItemDequeuedCallback callback) 
at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) 
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() 
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() 
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state) 
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2() 
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke() 
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks() 
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state) 
at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) 
at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) 
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) 
</StackTrace> 
<ExceptionString>System.ServiceModel.ProtocolException: Content Type application/soap+xml; charset=utf-8 was sent to a service expecting text/xml; charset=utf-8.  The client and service bindings may be mismatched.</ExceptionString> 
<DataItems> 
<Data> 
<Key>System.ServiceModel.Channels.HttpInput.HttpStatusCode</Key> 
<Value>UnsupportedMediaType</Value> 
</Data> 
<Data> 
<Key>System.ServiceModel.Channels.HttpInput.HttpStatusDescription</Key> 
<Value>Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.</Value> 
</Data> 
</DataItems> 
</Exception> 
</TraceRecord> 
</DataItem> 
</TraceData> 
</ApplicationData> 
</E2ETraceEvent>
Content Type application/soap+xml; charset=utf-8 was sent to a service expecting text/xml; charset=utf-8.  The client and service bindings may be mismatched 
  Cannot process the message because the content type ‘application/soap+xml; charset=utf-8′ was not the expected type ‘text/xml; charset=utf-8′. 

查了好久,得到A few tips when using WCF with BizTalk Server 2006 R2的启示,估计可能是C:\WINDOWS\TEMP没有写权限。将其设为everyone可读写后,则完全正常了。

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏Java成长之路

google Guava之EventBus

EventBus是Guava的事件处理机制,是设计模式中的观察者模式(生产/消费者编程模型)的优雅实现,在应用中可以处理一些异步任务。对于事件监听和发布订阅模式...

28820
来自专栏懒人开发

Eventbus3代码分析(七):整体结构

自己没有怎么花时间画图,怕可能有遗漏的地方 所以,先参考一下别人的代码分析 (之前的内容,应该没有雷同的地方,参考别人的分析,也是自我提高的过程) 我们先...

9420
来自专栏ACM小冰成长之路

POJ-3866-Exclusive Access 2

ACM模版 描述 ? ? ? 题解 这绝对是我做过最长的题,也是最难理解的题,翻译成中文都很难理解。 简单的说,就是安排任务使用两个资源的顺序,使最坏情况下,执...

19780
来自专栏calmound

HDU 4609 3-idiots

http://acm.hdu.edu.cn/showproblem.php?pid=4609 题意:给你一组数,问可以组成多少个三角形 分析:才知道原来有FFT...

29760
来自专栏calmound

POJ A Knight's Journey

题意:给你一定的格子的棋盘,一匹马是否可以遍历完全整个棋盘 1 #include<stdio.h> 2 #include<string.h> 3 cons...

367100
来自专栏calmound

畅通工程再续(最小生成树)

这道题被坑的难受,很基础的题目,但是还是wa的郁闷,主要的错误是不懂的分析,导致变量的定义出错,记录k点的最短边要double的却依旧写int导致wa的找不出错...

32270
来自专栏数据结构与算法

各种数论模板 不断更新 绝对精品

1.筛法求素数 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #inclu...

35790
来自专栏数据结构与算法

BZOJ1468: Tree

Description 给你一棵TREE,以及这棵树上边的距离.问有多少对点它们两者间的距离小于等于K Input N(n<=40000) 接下来n-1行边描...

32990
来自专栏数据结构与算法

BZOJ4698: Sdoi2008 Sandy的卡片(二分 hash)

7930
来自专栏数据结构与算法

洛谷P1351 联合权值(树形dp)

9420

扫码关注云+社区

领取腾讯云代金券