我正在尝试运行Web服务,但是我收到此错误: " 类型&System; Service.ServiceModel.FaultException`1'的例外情况发生在mscorlib.dll中但未在用户代码中处理
其他信息:Http请求已被禁用。"
Web服务在后台调用存储过程,但在发生此异常时它甚至无法到达。
让我知道这里要添加的其他信息。我正在使用.NET framework 4.7在VS 2015上运行该应用程序。
我不确定哪里开始寻找这个。谁能告诉我在哪里需要检查问题?
编辑:项目中web.config文件的内容:
注意:我最近不得不重新格式化我的笔记本电脑,之前该项目工作正常。我认为这可能与我如何设置IIS有关,也许有些设置是错误的?属性" HTTP激活"已签入"打开或关闭Windows功能"。检查图片:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="SampleEntities" connectionString="metadata=res://Models/Admin.Admin.csdl|res://Models/Admin.Admin.ssdl|res://Models/Admin.Admin.msl;provider=System.Data.SqlClient;provider connection string="data source=TServer;initial catalog=T_DB;persist security info=True;user id=user;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient"/>
</connectionStrings>
<!--
For a description of web.config changes for .NET 4.5 see http://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.5" />
</system.Web>
-->
<system.web>
<httpRuntime maxUrlLength="2097151" maxQueryStringLength="2097151"/>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<!--
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5">
<assemblies>
<remove assembly="SolverSDKNet20"/>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e077"/>
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID">
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Generic"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Runtime.Serialization"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Linq"/>
<add namespace="System.Xml.Linq"/>
<add namespace="System.ServiceModel.Web"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxUrl="4294967295" maxQueryString="4294967295"/>
</requestFiltering>
</security>
<directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension, LongDate"/>
</system.webServer>
<system.serviceModel>
<services>
<service behaviorConfiguration="FacadeWCF.SampleBehavior" name="FacadeWCF.Admin.clsSampleService">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_SampleService" contract="FacadeWCF.Admin.ISampleContract">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint binding="wsHttpBinding" bindingConfiguration="SSLwsHttpBinding_SampleService" contract="FacadeWCF.Admin.ISampleContract"/>
<endpoint address="basicHttp" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_SampleService" contract="FacadeWCF.Admin.ISampleContract"/>
<endpoint address="basicHttp" binding="basicHttpBinding" bindingConfiguration="SSLbasicHttpBinding_SampleService" contract="FacadeWCF.Admin.ISampleContract"/>
</service>
<service behaviorConfiguration="FacadeWCF.SampleRESTServiceBehavior" name="FacadeWCF.Admin.clsSampleRESTService">
<endpoint behaviorConfiguration="FacadeWCF.SampleRESTEndpointBehavior" binding="webHttpBinding" bindingConfiguration="webHttpBinding_SampleRESTService" contract="FacadeWCF.Admin.ISampleRESTContract"/>
<endpoint address="ssl" behaviorConfiguration="FacadeWCF.SampleRESTEndpointBehavior" binding="webHttpBinding" bindingConfiguration="SSLwebHttpBinding_SampleRESTService" contract="FacadeWCF.Admin.ISampleRESTContract"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_SampleService" closeTimeout="00:30:00" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
</binding>
<binding name="SSLbasicHttpBinding_SampleService" closeTimeout="00:30:00" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
<security mode="Transport"/>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="wsHttpBinding_SampleService" maxReceivedMessageSize="2147483647" messageEncoding="Mtom">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
<binding name="SSLwsHttpBinding_SampleService" maxReceivedMessageSize="2147483647" messageEncoding="Mtom">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
<webHttpBinding>
<binding name="webHttpBinding_SampleRESTService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"/>
<binding name="SSLwebHttpBinding_SampleRESTService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="FacadeWCF.SampleRESTEndpointBehavior">
<webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="FacadeWCF.SampleBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
<behavior name="FacadeWCF.SampleRESTServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<serviceActivations>
<add relativeAddress="SampleService.svc" service="FacadeWCF.Admin.clsSampleService"/>
<add relativeAddress="SampleRESTService.svc" service="FacadeWCF.Admin.clsSampleRESTService"/>
<add relativeAddress="SampleDataService.svc" service="FacadeWCF.Admin.clsSampleDataService" factory="System.Data.Services.DataServiceHostFactory, Microsoft.Data.Services, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e45"/>
</serviceActivations>
</serviceHostingEnvironment>
</system.serviceModel>
<appSettings file="User.config"/>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Spatial" publicKeyToken="31BF3856AD364E45" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31BF3856AD364E45" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31BF3856AD364E45" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31BF3856AD364E45" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
&#13;