I got many exceptions like:
Error 95 The type or namespace name 'Web' does not exist in the namespace 'MyProj.System' (are you missing an assembly reference?) C:\Projects\Solution\MyProj\Web References\GeneralServices\Reference.cs 269 24 MyProj
Error 108 The type or namespace name 'Uri' does not exist in the namespace 'MyProj
.System' (are you missing an assembly reference?) C:\Projects\Solution\MyProj\Web References\GeneralServices\Reference.cs 322 43 MyProj
The only thing I sis was adding WCF service (I already have web services in the same project). How can I solve those errors?? Where did they came from??
For some reason I don't know people closed this questions because they think it is fake question. So this is not a fake question and if they need more information - they can be specific and ask and I'll provide it. I know it looks like very generic question - but I really don't know what info to add.
It is nor a refernces problem for sure. It happend after I add wcf service and the all errors accurs in Reference.cs file that generated after I added an external web service.
*EDIT*
Here is the code of the WCF service I added. I am not sure that it is the problem:using System.Collections.Generic;
using System.Linq;
using MyProj.Domain.Business.Entities.System.Calls;
using MyProj.Domain.Business.EntitiesRepository.System.Calls;
using StructureMap;
namespace MyProj.System.WcfServices
{
public class SystemService : MyProjService, ISystemService
{
#region Calls
public Reason[] GetCallReasons()
{
开发者_如何学Python IReasonRepository rep =
ObjectFactory.GetInstance<IReasonRepository>();
return rep.GetReasonsList().ToArray();
}
public Call InsertCall(long reasonId, string phoneNumber, string description)
{
ICallRepository rep =
ObjectFactory.GetInstance<ICallRepository>();
return rep.Insert(User.UserCompany.CompanyId, reasonId, phoneNumber, description);
}
public void UpdateCall(long callId, long reasonId, string phoneNumber, string description)
{
ICallRepository rep =
ObjectFactory.GetInstance<ICallRepository>();
rep.Update(User.UserCompany.CompanyId, callId, reasonId, phoneNumber,
description);
}
public void CloseCall(long callId)
{
ICallRepository rep =
ObjectFactory.GetInstance<ICallRepository>();
rep.CloseCall(User.UserCompany.CompanyId, callId);
}
public IList<CallsListItem> GetCallsList(bool? isClosed)
{
ICallRepository rep =
ObjectFactory.GetInstance<ICallRepository>();
return rep.GetCallsList(User.UserCompany.CompanyId, isClosed);
}
public Call GetCall(long callId)
{
ICallRepository rep =
ObjectFactory.GetInstance<ICallRepository>();
return rep.GetCall(User.UserCompany.CompanyId, callId);
}
#endregion
}
}
*Another EDIT*
I remember that I also installed ef4.1 from Here. Maybe It make something??..*Another Another EDIT*
I think I figure it out! but I still don't know how to fix this.. The file that creates the errors hasusing System
, using System.Web
and so on. The Im My project I have also System Folder and the WCF service is in MyProj/System/WcfServices/SystemService.svc
. So, it creates a cs file with namespace MyProj.System.WcfServices
.
This namespace confused with System namespace! Because the file that creates the errors is generated by the system (it is the References.cs file that created for web reference) I can't edit the file. How can I solve it?..One solution would be to stop naming folders "System"!
Another solution would be to qualify the system namespaces:
using global::System;
using global::System.Web.UI;
etc.
These mean that you're missing an assembly reference. E.g. you are referencing a type in your code for which you have not added a reference to your project. It sounds like you need to add a reference to System.Web by right clicking on your project and choosing "Add Reference".
If that doesn't work then make sure your project is targeting the full .NET framework instead of the "Client Profile" - do this by right clicking on your project and choosing "Properties" and then set the "Target Framework" on the "Application" tab.
Even if it looks like the references are correctly added, perhaps there is a .NET version mismatch? .NET 4 Client doesn't support all WCF features, so that could be the problem. Sometimes intellisense and the complier don't quite see eye-to-eye, so it might look like everything is OK but then it fails to build.
You can check which version you're project is set to by right clicking on the project -> "Properties". Go to the "Application" tab, and check under "Target framework."
精彩评论