몇 달 전부터 아무런 문제없이 작동을 시작한 것은 매우 이상한 문제입니다. 401 Unauthorized 오류이지만 이상한 점은 Visual Studio에서 WCF 서비스 클래스를 빌드하는 동안 (즉, .svc를 강조 표시하고 W5C 클라이언트에서 실행하기 위해 F5를 누르십시오) 가져 오는 것입니다.HTTP 요청이 승인되지 않았습니다 ... 서버로부터받은 인증 헤더가 ''- Visual Studio 빌드 중입니까?
문제를 복합화하려면 문제가 발생합니다. 다른 동료는 소스 컨트롤 (TFS)에서 최신 코드를 가져 와서 Visual Studio에서 문제없이 서비스를 빌드하고 실행하기 만하면됩니다.
IIS Express applicationhost.config 파일을 수정하여 내 컴퓨터에서 모든 소스 코드를 삭제하고 소스 제어에서 새 버전으로 바꾸는 방법을 제안했습니다. 'remedies'에 대해서는 약간의 손실이 있습니다. , 내 (Win7) 시스템과 Visual Studio (2013) 등의 여러 번 재시작이 있었지만 차이점이 없었습니다.
나는이 오류의 많은 유사한 인스턴스를 보았습니다. 대부분이 '서버로부터받은 인증 헤더'에 대한 빈 문자열을 가지고 있지 않습니다. 온라인에서 읽은 대부분의 것들은 사람들이 가지고있는 것들입니다. 가치 또는 또 다른, 그리고 나는이 정확한 문제를 경험 한 사람을 찾는 것이 매우 어렵다는 것을 알았다. (예 : 표준 빌드에서 전체 IIS를 사용하지 않는 VS 내에서).
나는
가 여기에 정확한이다 ... 나는 다시, 그래서 어떤 제안은 매우 기꺼이받을 것이다 구축 얻을 수있을 때까지이 프로젝트는 이제 거의 죽은 물처럼 눈물이 내 머리를 시작 해요 제가 보는 오류 메시지와 맥락에서 그것의 스크린 샷 :Error: Cannot obtain Metadata from http://localhost:53171/BlotterService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:53171/BlotterService.svc Metadata contains a reference that cannot be resolved: 'http://localhost:53171/BlotterService.svc'. The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was ''. The remote server returned an error: (401) Unauthorized.HTTP GET Error URI: http://localhost:53171/BlotterService.svc There was an error downloading 'http://localhost:53171/BlotterService.svc'. The request failed with HTTP status 401: Unauthorized.
편집 :
내 applicationhost 의 .config는 다음과 같습니다
<sectionGroup name="security">
<section name="access" overrideModeDefault="Allow" />
<section name="applicationDependencies" overrideModeDefault="Allow" />
<sectionGroup name="authentication">
<section name="anonymousAuthentication" enabled="true" overrideModeDefault="Allow" />
<section name="basicAuthentication" overrideModeDefault="Allow" />
<section name="clientCertificateMappingAuthentication" overrideModeDefault="Allow" />
<section name="digestAuthentication" overrideModeDefault="Allow" />
<section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Allow" />
<section name="windowsAuthentication" overrideModeDefault="Allow" />
</sectionGroup>
<section name="authorization" overrideModeDefault="Allow" />
<section name="ipSecurity" overrideModeDefault="Deny" />
<section name="dynamicIpSecurity" overrideModeDefault="Deny" />
<section name="isapiCgiRestriction" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="requestFiltering" overrideModeDefault="Allow" />
</sectionGroup>
편집 2 :
그래서 난 그냥 (정식 버전에서와 같이) IIS는 ASP.NET의 모든 누락 된 기능을 가지고 있음을 깨달았다. 내 프로그램 및 기능 패널에서 "Windows 기능"을 더 확인하면 내 '응용 프로그램 개발 기능'섹션이 모두 실행 취소 된 것으로 나타났습니다. 이것은 사전에 사실이 아니었고, 나는 이것을 정확히하기 위해 무엇을했는지 궁금합니다. 난이 복직하고, IIS는 이제 그들에게 보여 주었다 확인 후, 여전히하고,편집 3 :
의 Web.config (마이너스 기록 블록, DB CONN 및 응용 프로그램 설정)은 다음과 같습니다
<configuration>
<system.web>
<authentication mode="Windows"/>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
<compilation debug="true"/>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<!-- QA-->
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="false" logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="false" />
</diagnostics>
<services>
<service behaviorConfiguration="Mba.Fed.BlotterService.BlotterServiceBehavior" name="Mba.Fed.BlotterService.BlotterService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="" name="BasicHttpBinding_ILegacyBlotter" contract="Mba.Fed.BlotterService.ILegacyBlotter">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" name="MexHttpBinding_IMetadataExchange" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Mba.Fed.BlotterService.BlotterServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
IIS Express가 더 이상 "익명"연결을 허용하지 않는 것처럼 보입니다. 로컬 IIS 보안 설정과 IUSR 계정을 다시 확인하여 사용 안 함/잠김 여부를 확인하십시오. – toadflakz
"local IIS settings"이라고하면 applicationhost.config에 대해 이야기하고 있습니까? 또는 전체 IIS UI? – Visionary
IIS에 대한 최종 누적 효과는 applicationhost.config와 서비스의 web.config의 조합입니다. 그 중 하나는 .config 파일을 통해 "익명"액세스를 비활성화 할 수 있습니다. – toadflakz