WCF web服务 - 不能在生产中使用它 [英] WCF webservice - can't use it in production

查看:111
本文介绍了WCF web服务 - 不能在生产中使用它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web服务,这给我的邮件发送列表。它工作正常在本地主机上,而不是在生产。

I have a webservice, that gives me a list of mails to send. It works fine on localhost, but not in production.

我的web服务应不以任何一切限制访问。这不是安全的根本,但坦率地说在这一点上,我不在乎它。

My webservice should be accessible without any limit at all. It's not safe at all, but frankly, at this point, I don't care about it at all.

我得到这些错误:

  • The caller was not authenticated by the service, which I resolved with this : http://forums.asp.net/t/1324170.aspx
  • Incoming binary negotiation has invalid ValueType, resolved using this : http://social.msdn.microsoft.com/Forums/en/wcf/thread/4b014224-d5d9-41d0-9441-48ccd2fb44cd
  • The request for security token has invalid or malformed elements, resolved using this : http://www.vistax64.com/indigo/151689-wcf-security-request-security-token-could-not-satisfied.html

我已经在这整整一天,我怕我不记得我做了哪些修改为哪个错误。。

I've been at it the whole day, and I fear I don't remember which modification I did for which error.

我得到了最新的错误是...一个跛脚超时,没有的InnerException。不过,有趣的是:我每天超时时间设置为10小时,而我几秒钟后收到超时

The latest error I got is... a lame timeout, without innerexception. But, the funny thing is : I have configured every timeout to be 10 hours, and I get the timeout after a few seconds.

我的web.config(服务器)有这个(实际上,它有4个web服务,但我只留下一个我想现在使用):

My web.config (server) has this (actually, it has 4 webservices, but I left only the one I'm trying to use now) :

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="wsHttpBinding" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferPoolSize="20000000" useDefaultWebProxy="true">
                <security mode="Message">
                    <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
                </security>
            </binding>
            <binding name="NoSecurityBinding" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferPoolSize="20000000" useDefaultWebProxy="true">
                <security mode="Message">
                    <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="true" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="CentresInteretBehavior">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true" />
                <serviceCredentials>
                    <windowsAuthentication allowAnonymousLogons="true" />
                </serviceCredentials>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="CentresInteretBehavior" name="CentresInteret">
            <endpoint address="" binding="wsHttpBinding" contract="ICentresInteret" bindingConfiguration="NoSecurityBinding">
                <identity>
                    <dns value="localhost" />
                    <userPrincipalName value=".\ASPNET" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        </service>
    </services>
</system.serviceModel>

我的app.config(客户端)有这个(同样的事情:多WS,只有一个叫):

My app.config (client) has this (same thing : multiple WS, only one called) :

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_ICentresInteret" closeTimeout="10:00:00"
                openTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00"
                bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="20000000" maxReceivedMessageSize="20000000"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                allowCookies="false">
                <readerQuotas maxDepth="32" maxStringContentLength="200000000"
                    maxArrayLength="200000000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="10:00:00" enabled="false" />
                <security mode="None">
                    <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="false"
                        algorithmSuite="Default" establishSecurityContext="true" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://www.ourserver.com/WebServices/CentresInteret.svc"
            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICentresInteret"
            contract="CentresInteretService.ICentresInteret" name="WSHttpBinding_ICentresInteret">
            <identity>
                <dns value="localhost" />
                <userPrincipalName value=".\ASPNET" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>

服务器跟踪让我这一点,只需要几秒钟(约10-15)红线后(请问我是否需要另一条线路):

The server trace gets me this, after just a few seconds (about 10-15) on the red line (please ask me if you need another line) :

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
        <EventID>131076</EventID>
        <Type>3</Type>
        <SubType Name="Error">0</SubType>
        <Level>2</Level>
        <TimeCreated SystemTime="2011-11-28T17:46:26.6525694Z" />
        <Source Name="System.ServiceModel" />
        <Correlation ActivityID="{f624ff35-a8ae-4636-bd46-2138207af7a1}" />
        <Execution ProcessName="w3wp" ProcessID="20424" ThreadID="7" />
        <Channel />
        <Computer>SRV-WEB-01</Computer>
    </System>
    <ApplicationData>
        <TraceData>
            <DataItem>
                <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
                    <TraceIdentifier>http://msdn.microsoft.com/fr-FR/library/System.ServiceModel.Diagnostics.TraceHandledException.aspx</TraceIdentifier>
                    <Description>Traitement d’une exception.</Description>
                    <AppDomain>/LM/W3SVC/4/ROOT-1-129669759749681489</AppDomain>
                    <Exception>
                        <ExceptionType>System.Net.WebException, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
                        <Message>Le délai d'attente de l'opération a expiré.</Message>
                        <StackTrace>
                            à System.Net.HttpWebRequest.GetResponse()
                            à CentresInteret.RecupererContenuMail(Int32 contact_id, Int32 frequence_id, Int32 organisme_id) dans D:\...\App_Code\WebServices\CentresInteret.vb:ligne 181
                            à CentresInteret.GetEmails(Boolean PrendreEnCompteFrequence) dans D:\...\App_Code\WebServices\CentresInteret.vb:ligne 87
                            à SyncInvokeGetEmails(Object , Object[] , Object[] )
                            à System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp;amp; outputs)
                            à System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
                        </StackTrace>
                        <ExceptionString>
                            System.Net.WebException: Le délai d'attente de l'opération a expiré.
                            à System.Net.HttpWebRequest.GetResponse()
                            à CentresInteret.RecupererContenuMail(Int32 contact_id, Int32 frequence_id, Int32 organisme_id) dans D:\...\App_Code\WebServices\CentresInteret.vb:ligne 181
                            à CentresInteret.GetEmails(Boolean PrendreEnCompteFrequence) dans D:\...\App_Code\WebServices\CentresInteret.vb:ligne 87
                            à SyncInvokeGetEmails(Object , Object[] , Object[] )
                            à System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp;amp; outputs)
                            à System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp;amp; rpc)
                            à System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
                        </ExceptionString>
                    </Exception>
                </TraceRecord>
            </DataItem>
        </TraceData>
    </ApplicationData>
</E2ETraceEvent>

请请pretty请,有一个想法。我所有了出来。我要去稍疯了。

Please please pretty please, have an idea. I'm all out of them. And I'm going slightly mad.

谢谢!

修改:解决了!在线路181 CentresInteret.vb,有:

Edit : solved ! In CentresInteret.vb at line 181, there is :

    Dim req As HttpWebRequest = WebRequest.Create(pageModele)
    req.Timeout = 10000
    Dim resp As HttpWebResponse = req.GetResponse() ' throws the error

我添加了超时为零,而现在它的作品!显然,超时10秒还不够......

I added a zero in the timeout, and now it works ! Apparently, 10 seconds of timeout weren't enough...

推荐答案

如果此跟踪是从您的服务器(而不是客户端),那么我很好奇的错误:

If this trace was from your server (not the client) then I am curious about the error:

CentresInteret.RecupererContenuMail(CONTACT_ID的Int32,的Int32 frequence_id,的Int32 organisme_id)丹斯D:\\ APP_ code \\的WebServices \\ CentresInteret.vb:LIGNE 181

CentresInteret.RecupererContenuMail(Int32 contact_id, Int32 frequence_id, Int32 organisme_id) dans D:...\App_Code\WebServices\CentresInteret.vb:ligne 181

它看起来像 CentresInteret.RecupererContenuMail()方法是在你的code的方法之一?如果是这样,什么是文件的行181 CentresInteret.vb 在做什么?它看起来像它可能会得到超时而查询的东西吗?也许它做一个DB调用或该线路上的另一个Web服务的调用?

It looks like the CentresInteret.RecupererContenuMail() method is one of the methods in your code? If so, what is line 181 of the file CentresInteret.vb doing? It looks like it might be getting a timeout while querying something? Maybe its doing a DB call or a call to another web service on that line?

异常的这一部分:

System.Net.WebException:乐德来德attente DE L'操作一到期。
        àSystem.Net.HttpWebRequest.GetResponse()

System.Net.WebException: Le délai d'attente de l'opération a expiré. à System.Net.HttpWebRequest.GetResponse()

使它看起来像你的web服务code正在另一个Web请求到其他服务,可能会超时。如果奥尤正在查询另一个服务(如交易所或一些POP3邮件服务器),那么它的超时可能是10-15秒,而超时鼓泡到你的WCF客户端(尽管如the_ajp提到的,它应该被包裹在一个的FaultException )

Makes it look like your web service code is making another web request to another service, and might be timing out. If oyu are querying another service (like Exchange or some POP3 mail server) then its timeout might be 10-15 seconds, and that timeout bubbling up to your WCF client (though as the_ajp mentioned, it should be wrapped in a FaultException at the client.)

这篇关于WCF web服务 - 不能在生产中使用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆