WCF, ServiceHost 지시문의 서비스 특성 값을 찾을 수 없습니다.
IIS 6으로 서비스를 호스팅하려고하는데이 예외가 계속 발생합니다.
Server Error in '/WebServices' Application.
--------------------------------------------------------------------------------
The type 'QS.DialogManager.Communication.IISHost.RecipientService', provided as the Service attribute value in the ServiceHost directive could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The type 'QS.DialogManager.Communication.IISHost.RecipientService', provided as the Service attribute value in the ServiceHost directive could not be found.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The type 'QS.DialogManager.Communication.IISHost.RecipientService', provided as the Service attribute value in the ServiceHost directive could not be found.]
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +6714599
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +604
System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +46
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +654
[ServiceActivationException: The service '/WebServices/dm/RecipientService.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'QS.DialogManager.Communication.IISHost.RecipientService', provided as the Service attribute value in the ServiceHost directive could not be found..]
System.ServiceModel.AsyncResult.End(IAsyncResult result) +15626880
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +15546921
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +265
System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +227
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082
내 어셈블리를 찾을 수없는 것 외에는 전혀 단서가 없습니다. 코드는 공용 클래스로 올바르게 컴파일되어야합니다.
내 .svc 파일은 다음과 같습니다.
<%@ ServiceHost Language="C#" Debug="true" Service="QS.DialogManager.Communication.IISHost.RecipientService" CodeBehind="RecipientService.svc.cs" %>
나는 이것이 효과가 있는지도 알지 못하지만 여전히 똑같은 오래된 오류가 나타나는 매우 간단한 서비스를 만들려고했습니다.
The type 'IISHost.Service1', provided as the Service attribute value in the ServiceHost directive could not be found.
옵션 1 :
이 메시지는 종종 IIS 7 구성 문제로 인해 발생합니다. 서비스가있는 폴더를 가리키는 가상 디렉터리를 만드는 데 익숙하다면 더 이상 작동하지 않습니다. 이제 대신 "응용 프로그램 만들기 ..."옵션을 사용해야합니다.
기타 옵션 :
문제는 svc.cs 파일에서와 같이 svc 파일의 다른 네임 스페이스에있을 수도 있습니다.
svc 파일에서 네임 스페이스는 다음 형식이어야합니다.
Service="Namespace.SvcClassName"
나는 이것이 아마도 "명백한"대답이라는 것을 알고 있지만, 그것은 나를 약간 넘어 뜨렸다. bin 폴더에 프로젝트에 대한 dll이 있는지 확인하십시오. 서비스가 게시되었을 때이를 게시 한 사람은 dll이 GAC에 있다고 생각했기 때문에 dll을 삭제했습니다. 프로젝트 (이 경우에는 QS.DialogManager.Communication.IISHost.RecipientService.dll)를위한 것이 없었습니다.
매우 다른 이유로 동일한 오류입니다.
이 오류는 .SVC 파일의 서비스 이름이 일치하지 않아 발생합니다. 아마도 인터페이스를 구현하는 서비스 클래스의 이름을 변경했을 수 있습니다. 솔루션은 .SVC 파일을 열고 Service 속성 및 CodeBehind 속성과 정확히 일치하는 것입니다. 따라서 .SVC 파일은 다음과 같아야합니다.
<%@ ServiceHost Language="Language you are using" Debug="bool value to enable debugging" Service="Service class name that is implementing your Service interface" Codebehind="~/Appcode/Class implementing interface.cs"%>. for eg.
<%@ ServiceHost Language="C#" Debug="true" Service="Product.Service" CodeBehind=~/AppCode/Product.Service.cs"%>
이 예제는 디버깅이 활성화 된 서비스 클래스 구현 인터페이스와 함께 C # 언어를 사용하는 .svc 파일에 대한 것이며이 클래스는 Service.cs라는 이름의 앱 폴더 내에 있으며 Product는 Service 클래스의 네임 스페이스입니다.
또한 서비스 구성 파일에서 각각 변경하십시오.
<system.serviceModel>
<services>
<service name="Product.Service" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="wsHttpBinding" contract="Product.Iservice">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<behavior name="ServiceBehavior">
<serviceMetaData httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</behaviors>
</system.serviceModel>
.svc 파일의 ServiceHost 지시문에서 올바른 유형을 참조하고 있는지 다시 확인하십시오. 방법은 ...
- 웹 서비스가 포함 된 VS 프로젝트에서 XML 편집기에서 .svc 파일을 엽니 다 (파일을 마우스 오른쪽 단추로 클릭하고 연결 프로그램 ...을 선택하고 XML (텍스트) 편집기를 선택한 다음 확인).
- Note the "Service" attribute value.
- Make sure it matches the fully qualified type name of your service. This includes the namespace + type name. For example, if the namespace is "MyCompany.Department.Services" and the class is called "MyService", then the Service attribute value should be "MyCompany.Department.Services.MyService".
I had the same Exception, this is due to the Type not correctly mentioned in the .svc file
I corrected with below fix.
if your .svc.cs has class like this
namespace Azh.Services.MyApp
{
public class WcfApp : FI.IWcfAppService
{
...
}
}
for this the .svc file should look like this
<%@ ServiceHost Language="C#" Debug="true" Service="Azh.Services.MyApp.WcfApp" CodeBehind="WcfApp.svc.cs" %>
You should configure your bin folder path to service local bin.
I practically solved the same issue . Here is my suggestion -- The error means that the object referenced in the Service attribute is not found. For the object to be found, the application or library must build output to the bin folder.
You can edit property page of the application and specify the output path to 'bin'.
If you have renamed anything verify the (Properties/) AssemblyInfo.cs
is correct, as well as the header in the service file.
ServiceName.svc
<%@ ServiceHost Language="C#" Debug="true" Service="Company.Namespace.WcfApp" CodeBehind="WcfApp.svc.cs" %>
Aligning with your namespace in your Service.svc.cs
Two keys to this for certain flavors of the ' Service attribute value in the ServiceHost directive could not be found'-problem: (1) If you're working in Silverlight, you should use the Silverlight WCF-Enabled Service, not the non-Silverlight WCF Service; this will update Web.Config for the bindings and allow the type to be visible; (2) Match the class name in the new service to the Service name -- the goal here is to make a wsdl... so that you know the service's functionality is exposed to your Silverlight client and to the Web; it helps to have the service match the class. If you get the names gummed up, you will have to edit the Web.Config in 3 places (serviceBehaviors, services and bindings).
There were so many sincere attempts to help folks with this problem that were not helpful to me that it should be stressed that this write-up is for a Silverlight solution and it may not apply for someone not using Silverlight 3 in a client/Web configuration.
Hope it helps.
I had the same problem but no clue what caused it. I Solved it by changing from Debug to Release and Run using Debug/Start New Instance. After that, it ran in both Release and Debug. It was magic...
I also ran into this issue trying the Microsoft.ServiceModel.Samples.Calculator WCF sample. I am using IIS 5.1. I resolved it by ensuring that the website that was auto-generated (servicemodelsamples) was not an application. Right-click the folder, click "Properties" and click the "Create" button.
I had this problem - my service type was in the GAC. It WOULD work if i added the dll containing the type to the bin folder but as it was in the GAC this was NOT what I wanted. I eventually added this to the web.config for the service
<system.web>
<customErrors mode="RemoteOnly" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="[name in GAC], Version=[version in GAC], Culture=neutral, PublicKeyToken=[ac token]" />
</assemblies>
</compilation>
</system.web>
and it worked without needing any dlls in the bin folder.
I had my service dll's in the bin folder where the svc file was residing. Moving the dll's to the root bin folder solved the problem.
In my case Right Click on Virtual Directory and Select "Convert To Application" worked!
I faced with this error today, reason was; IIS user doesn't have permission to reach to the application folder. I gave the read permissions to the app root folder.
This may sound trivial, but worth mentioning: You have to build the service (in Visual Studio) - then a DLL will be created in the bin subfolder.
When the service is "deployed" on a server - that bin folder needs to have that DLL file in it - otherwise this error will be thrown...
Add reference of service in your service or copy dll.
Building the solution before adding the service reference solved my problem.
I got this error when trying to add the Service reference for the first Silverlight enabled WCF in the same solution. I just build the .Web project and it started working..
I had the same problem, found this thread, tried all but nogo.
Then I spend another 4 hours wasted time.
Then I found that the compilation settings had changed from 64bits to x86. When I changed it back to 64bits it worked. Don't know exactly why but could be that the IIS application pool was not set to allow 32 bit applications.
Make sure markup (svc) file has service attribute with namespace.classname and codebehind will be classname.svc.cs
Rebuild the solution
Restart the app pools from local IIS once.
'developer tip' 카테고리의 다른 글
Android-모든 화면의 배경색을 설정하는 방법은 무엇입니까? (0) | 2020.10.28 |
---|---|
AngularJS가있는 Twitter Bootstrap Navbar-축소가 작동하지 않음 (0) | 2020.10.28 |
라디오 버튼을 토글 버튼처럼 만드는 방법 (0) | 2020.10.28 |
이름이있는 DispatcherServlet에서 URI가있는 HTTP 요청에 대한 매핑을 찾을 수 없습니다. (0) | 2020.10.28 |
정적 bower_components를 제공하도록 노드 익스프레스를 구성 하시겠습니까? (0) | 2020.10.28 |