【发布时间】:2011-05-08 13:20:19
【问题描述】:
一直在研究连接到我们服务器上的 WCF 服务的 Silverlight 应用程序。我正在使用 .NET 4.0 进行开发。在本地一切正常,但我尝试在我们的服务器上部署 WCF 服务,但它不起作用。
服务运行良好,我通过在浏览器中输入 URL 进行了检查。但是每当我从我的 Silverlight 应用程序中拨打电话时,它都会失败并出现错误:
System.ServiceModel.CommunicationException:远程服务器返回错误:NotFound。
我的 Web.Config 文件在下面给出了详细的错误。我使用 fiddler 检查消息,我可以看到来自服务器的响应包含文本。
a:身份验证失败。访问被拒绝。
我能做些什么来解决这个问题?问题是我的托管服务器不允许在 IIS 中打开 Windows 身份验证。找不到该设置。我正在使用 Godaddy Windows 托管。
任何指针?
Web.Config:
<authentication mode="Windows"/>
<customErrors mode="Off"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"></serviceHostingEnvironment>
<services>
<service name="WarpArtOnline.Service1" behaviorConfiguration="WarpArtOnline.Service1Behavior">
<endpoint binding="basicHttpBinding" bindingConfiguration="MaxSizeBinding" contract="WarpArtOnline.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="MaxSizeBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<!--<transport clientCredentialType="Windows"/>-->
<!--<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />-->
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WarpArtOnline.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
错误:
{System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c_DisplayClass5.b_4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c_DisplayClass4.b_1(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase1.ChannelBase1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at ImagingSL.WebWarp.Service1Client.Service1ClientChannel.EndwarpImage(IAsyncResult result)
at ImagingSL.WebWarp.Service1Client.ImagingSL.WebWarp.IService1.EndwarpImage(IAsyncResult result)
at ImagingSL.WebWarp.Service1Client.OnEndwarpImage(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}
【问题讨论】:
-
嗯,通过 Internet 使用 Windows 身份验证。什么样的用户应该使用该服务?
-
任何人都应该可以访问该服务。
标签: c# .net silverlight wcf