我正在尝试在我的web api Web服务中接收base64字符串(这是一个图像)。
我遇到的问题是字符串的长度,是否有一种方法可以设置传入字符串的限制以允许字符串的大小?该字符串已经过编码以供URL使用。据我所知,这是我的问题。现在,如果我调用该函数,它会给我404错误。但是,如果我删除base64string并只放入一个普通的字符串就可以了。
这是我的功能
public int userLogin(string identifier, string name, string hometown, string photo)
{
da = new SqlDataAdapter();
ds = new DataSet();
command = new SqlCommand("p_userLogin", connection);
command.Parameters.AddWithValue("@userInfo", identifier);
command.Parameters.AddWithValue("@name", name);
command.Parameters.AddWithValue("@hometown", hometown);
command.Parameters.AddWithValue("@photo", photo);
command.CommandType = CommandType.StoredProcedure;
da.SelectCommand = command;
da.Fill(ds);
int userID = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
return userID;
}
这是我尝试发送的基本64字符串
%2F9j%2F4AAQSkZJRgABAgAAAQABAAD%2F%2FgAEKgD%2F4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCIFhZWiAH3AABABkAAwApADlhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApkZXNjAAAA%2FAAAAF5jcHJ0AAABXAAAAAt3dHB0AAABaAAAABRia3B0AAABfAAAABRyWFlaAAABkAAAABRnWFlaAAABpAAAABRiWFlaAAABuAAAABRyVFJDAAABzAAAAEBnVFJDAAABzAAAAEBiVFJDAAABzAAAAEBkZXNjAAAAAAAAAANjMgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0ZXh0AAAAAEZCAABYWVogAAAAAAAA9tYAAQAAAADTLVhZWiAAAAAAAAADFgAAAzMAAAKkWFlaIAAAAAAAAG%2BiAAA49QA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fNjP%2FxAAaEQEAAwEBAQAAAAAAAAAAAAABABEhEDEg%2F9oACAECEQE%2FEIPAUuBY%2BKjAXA0imzXztyoRE7MjwdTJdTJMqIOS%2Bf%2FEACARAAIABQUBAAAAAAAAAAAAAAABEBEhMeEgcZGh8EH%2F2gAIAQERAT8QiwRp1hKLsOqYregkJ%2FsCnMbIlBeeQ6bd4HMt7gSlt3g294Ni5wf%2FxAAnEAEAAgIABgICAgMAAAAAAAABABEhMUFRYXGBkRDwIKGxwdHh8f%2FaAAgBAAABPxD8bHBvyAtgSxubWaeyjq3OWmhRcWa5BGuE702QdPYj5fh%2BWLBlL3GAokoQq7dXgYYJuyUWKCqNrMBct19ib7rYxnGmY9RPIjrFx7qNJlNYUH8x%2FB3OmW8%2FjJkUoBss3jSnmAoWwqwwvHHq6hStcYl5NWiZyjeWGrZBwArVeX3DtqbgEUuQIPEflgkW35Ciyo7Zf1cIFq8yPv8AzGvE029aczugohlJgKoQa78%2FEfik06SiWQbYMy7BGLHsHL4gMPQBHKEsC1PEqUcDUxvtcBUBzdDnAkkL4UwK4bOJu%2Be%2Fhm0Uxt5VHo3t5%2B2IQxVlnJLe4J1imuUmbyK8C%2BssiZbu8VuFIDhX79QPiMEE2tf8QNTVZsL61sHKznGcZ7JWSigchks6B6VCjzgL6NBh8RtB77jjuODlgMIAlDSf1cGoiTwUbXGsNrdpqgAKcRoBCmkrYDTV3DM1O5T2Fd25g4SuNI9OxqACkmq5A4jCbarwqbiXHdl%2Fo8RcALYRTkcwgTUNq9x3BYURVZikFM1dPgiGZ1v%2FAHxRft94XAh3ojx6zGRwwGliiTcA5LTESZAtbwDiXeAq%2FwC8QFpj75gF%2Bn5hS%2Bn5n%2F%2FZ
对此的任何意见都表示赞赏。
答案 0 :(得分:0)
我不知道你是否得到了答案,因为问题已经发布很久了。
我也面临同样的问题,解决了我的问题 以下链接可以帮助您找到答案@Ken