我创建了一个WCF应用程序,但是在godaddy(共享主机)上托管它时,我面临着问题。在我的本地,我能够从IIS访问.svc文件,但在godaddy上传后,它开始抛出错误。
我是托管共享服务器上的工作类型的新手。所以不知道天气我错误地编码,错误配置或错误地上传到服务器上?我正在使用MS Sql server和.net framework 3.5。
我收到以下错误
Server Error in '/' Application.
“WCF35app.LinkuService”类型,作为ServiceHost指令中的Service属性值提供,或者在配置元素system.serviceModel / serviceHostingEnvironment / serviceActivations中提供。
描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:
System.InvalidOperationException: The type 'WCF35app.LinkuService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
来源错误:
在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。
堆栈追踪:
[InvalidOperationException: The type 'WCF35app.LinkuService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.]
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +62739
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1429
System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +52
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +598
[ServiceActivationException: The service '/WCF35app/LinkuSystem.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'WCF35app.LinkuService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found..]
System.Runtime.AsyncResult.End(IAsyncResult result) +486572
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +174
System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +345998
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +9683593
Web.config代码是
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
<customErrors mode="Off"/>
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="WCF35app.LinkuService" behaviorConfiguration="WCF35app.Service1Behavior">
<host>
<baseAddresses>
<add baseAddress = "http://augustinfotechhosting.com/WCF35app/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="webHttpBinding" contract="WCF35app.ILinkuService" behaviorConfiguration="web">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WCF35app.Service1Behavior">
<!-- To avoid disclosing metadata information,
set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webHttpBinding">
<security mode="None" />
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
我的.svc文件有一行代码如下。
<%@ ServiceHost Language="C#" Debug="true"
Service="WCF35app.LinkuService"
CodeBehind="~/LinkuService.cs"
%>