Khi tôi bấm chuột phải vào Eval.svc
trong Visual Studio 2012 và tầm nhìn trong trình duyệt, tôi nhận được sau -WCF Service, loại được cung cấp như các giá trị thuộc tính dịch vụ ... không thể tìm được
Loại 'EvalServiceLibary. Đánh giá ', được cung cấp dưới dạng giá trị thuộc tính Dịch vụ trong chỉ thị ServiceHost hoặc được cung cấp trong phần tử cấu hình system.serviceModel/serviceHostingEnvironment/serviceActivations không thể tìm thấy.
Khi tôi chạy dịch vụ WCF từ máy khách thử nghiệm, tất cả đều hoạt động tốt.
dịch vụEval:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class EvalService : IEvalService
{
Dictionary<string, JobPhaseTimer> jobTimers = new Dictionary<string, JobPhaseTimer>();
public void SubmitEntry(ENBO.Jobs.Job job, ENBO.Jobs.JobDetail jobDetail, ENBO.TimeLogs.TimeLog timeLog, ENBO.Users.User user, ENBO.Utilities.EntryType entryType, JobPhase jobPhase)
{
if (entryType == EntryType.Active)
{
JobPhaseTimer timer = new JobPhaseTimer();
timer.UID = job.ID + "_" + jobPhase.ID;
timer.JobID = job.ID;
timer.JobDetailID = jobDetail.ID;
timer.PhaseID = jobPhase.ID;
timer.StartTime = DateTime.Now;
timer.Stopwatch.Start();
jobTimers.Add(timer.UID, timer);
TimeLog log = new TimeLog();
log.JobID = job.ID;
log.PhaseID = jobPhase.ID;
log.UserID = user.ID;
log.DateEntry = DateTime.Now;
log.EntryType = EntryType.Active;
if (log.AddNewTimeLog())
{
//Do something
}
}
else if (entryType == EntryType.Paused)
{
JobPhaseTimer timer = jobTimers[job.ID + "_" + jobPhase.ID];
timer.Stopwatch.Stop();
TimeLog log = new TimeLog();
log.JobID = job.ID;
log.PhaseID = jobPhase.ID;
log.UserID = user.ID;
log.DateEntry = DateTime.Now;
log.EntryType = EntryType.Paused;
if (log.AddNewTimeLog())
{
//Do something
}
}
}
}
IEvalService.cs
(Hợp đồng dịch vụ)
[ServiceContract]
public interface IEvalService
{
[OperationContract]
void SubmitEntry(Job job, JobDetail jobDetail, TimeLog timeLog, User user, EntryType entryType, JobPhase jobPhase);
}
Eval.svc
đánh dấu:
<%@ ServiceHost Language="C#" Debug="true" Service="EvalServiceLibary.Eval" %>
Web.config
:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
<service name="EvalServiceLibary.EvalService">
<endpoint address="" behaviorConfiguration="" binding="webHttpBinding"
contract="EvalServiceLibary.IEvalService" />
<endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
contract="EvalServiceLibary.IEvalService" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="EvalServiceSite.EvalAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
Bất kỳ ý tưởng nào khiến tôi gặp phải lỗi này? Tôi đã tìm kiếm trên Google và gặp một vài trang nhưng dường như không có gì hiệu quả.
Cảm ơn!
là một dự án web? Web.config như thế nào? – Aliostad
Có, một dự án web. Tôi đã thêm web.config vào câu hỏi. Chúc mừng – dynamicuser